将SpringBoot项目作为依赖库引入时出现类找不到问题求助
问题:引入本地SpringBoot项目Jar包后Maven提示类不存在
我想把SpringBoot项目mylibrary的包引入另一个项目cadmdb2。已经从mylibrary生成Jar包导出到本地硬盘,再导入到cadmdb2中,但执行maven install时报错,提示mylibrary里的Company类不存在。相关截图和cadmdb2的pom.xml配置如下:

cadmdb2的pom.xml配置
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.11</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>pl.krzysztofskul</groupId> <artifactId>cadmdb</artifactId> <version>0.1-SNAPSHOT</version> <name>cadmdb</name> <description>CADmedica spring boot application | hospital planning and calculation</description> <properties> <java.version>12</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web-services</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.17</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/com.thedeanda/lorem --> <dependency> <groupId>com.thedeanda</groupId> <artifactId>lorem</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>pl.krzysztofskul</groupId> <artifactId>mylibrary</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
添加mylibrary依赖后的项目结构截图:
内容的提问来源于stack exchange,提问作者krzysztofskul
相关产品推荐
相关产品推荐

