>>>>spring cloud 多模塊html
>>>>在idea上使用maven插件打包,欲打包成jar包後 進行部署java
>>>>spring
報錯:程序包XXX不存在apache
==============================================================================app
OK,開始研究這個問題:maven
通常清理都會成功,就是刪除target目錄下的編譯的class文件以及配置等ide
開始打包,控制檯顯示日誌:spring-boot
可是 報錯來的也很忽然:ui
也就是說,明明程序包是存在的,可是依舊報錯:idea
[ERROR]COMPILATIONERROR: [INFO]------------------------------------------------------------- [ERROR]/D:/document/IdeaProjects/springcloud/springcloud-ms-gateway/src/main/java/com/swapping/springcloud/ms/gateway/fallback/UniVerFallback.java:[4,49]程序包com.swapping.springcloud.ms.core.response不存在 [ERROR]/D:/document/IdeaProjects/springcloud/springcloud-ms-gateway/src/main/java/com/swapping/springcloud/ms/gateway/filter/AuthFilter.java:[7,49]程序包com.swapping.springcloud.ms.core.response不存在 [INFO]2errors [INFO]------------------------------------------------------------- [INFO]------------------------------------------------------------------------ [INFO]ReactorSummary: [INFO] [INFO]springcloud0.0.1-SNAPSHOT.........................SUCCESS[1.342s] [INFO]springcloud-ms-core................................SUCCESS[0.748s] [INFO]springcloud-ms-eureka..............................SUCCESS[11.148s] [INFO]springcloud-ms-gateway.............................FAILURE[1.166s] [INFO]springcloud-ms-hystrix-turbine.....................SKIPPED [INFO]springcloud-ms-sleuth-zipkin.......................SKIPPED [INFO]tx-manager4.2.0...................................SKIPPED [INFO]springcloud-ms-member..............................SKIPPED [INFO]springcloud-ms-goods...............................SKIPPED [INFO]springcloud-ms-integral............................SKIPPED [INFO]springcloud-ms-test0.0.1-SNAPSHOT.................SKIPPED [INFO]------------------------------------------------------------------------ [INFO]BUILDFAILURE [INFO]------------------------------------------------------------------------ [INFO]Totaltime:15.002s [INFO]Finishedat:2018-12-11T21:53:21+08:00 [INFO]------------------------------------------------------------------------ [ERROR]Failedtoexecutegoalorg.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile(default-compile)onprojectspringcloud-ms-gateway:Compilationfailure:Compilationfailure: [ERROR]/D:/document/IdeaProjects/springcloud/springcloud-ms-gateway/src/main/java/com/swapping/springcloud/ms/gateway/fallback/UniVerFallback.java:[4,49]程序包com.swapping.springcloud.ms.core.response不存在 [ERROR]/D:/document/IdeaProjects/springcloud/springcloud-ms-gateway/src/main/java/com/swapping/springcloud/ms/gateway/filter/AuthFilter.java:[7,49]程序包com.swapping.springcloud.ms.core.response不存在 [ERROR]->[Help1] [ERROR] [ERROR]Toseethefullstacktraceoftheerrors,re-runMavenwiththe-eswitch. [ERROR]Re-runMavenusingthe-Xswitchtoenablefulldebuglogging. [ERROR] [ERROR]Formoreinformationabouttheerrorsandpossiblesolutions,pleasereadthefollowingarticles: [ERROR][Help1]http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException [ERROR] [ERROR]Aftercorrectingtheproblems,youcanresumethebuildwiththecommand [ERROR]mvn<goals>-rf:springcloud-ms-gateway
那麼這個問題怎麼解決呢?
最快捷簡單的辦法,就是將父級項目的pom.xml文件中,的maven插件註釋,【只保留子模塊的插件便可】【我這裏子級模塊中都沒有顯示加入插件,因此只註釋了父級項目中的maven插件,就能夠打包成功了】便可
<build> <!--<plugins>--> <!--<plugin>--> <!--<groupId>org.springframework.boot</groupId>--> <!--<artifactId>spring-boot-maven-plugin</artifactId>--> <!--</plugin>--> <!--</plugins>--> </build>
而後再進行打包操做,便可成功: