赞
踩
现在有个微服务项目,里面ServiceProvider模块依赖Common模块,依赖是这么添加的
<!--添加common项目依赖--> <dependency> <groupId>com.figo</groupId> <artifactId>Common</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency>
正常的开发调试时没有问题,但是通过mvn打包时报错:
[WARNING] The POM for com.figo:Common:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ServiceProvider: Compilation failure: Compilation failure:
[ERROR] /E:/IdeaProjects/UPPoint/PointServiceProvider/src/main/java/com/figo/serviceprovider/controller/TestController.java:[3,38] 程序包com.figo.common.utils不存在
解决办法:
1.Common模块pom.xml里面build需要将spring-boot-maven-plugin注释
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.1</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- <!-- 需要注释,不然Provider模块无法引用,因为Provider是web模块,里面也有mainClass
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <version>2.3.7.RELEASE</version>
- <configuration>
- <mainClass>com.figo.common.CommonApplication</mainClass>
- </configuration>
- <executions>
- <execution>
- <id>repackage</id>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- -->
- </plugins>
- </build>
2.先打Common包
E:\IdeaProjects\MyProject\Common>mvn clean install -Dmaven.skip.test=true
3.再打ServiceProvider包
E:\IdeaProjects\MyProject\ServiceProvider>mvn clean install -Dmaven.skip.test=true
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。