解决IDEA maven多模块打包问题
参考:
https://www.jianshu.com/p/37c6688c4fcb
https://blog.csdn.net/sjhuangx/article/details/71519066
https://blog.csdn.net/qq_33547169/article/details/78866859
以此项目举例,zysuyuan-item-service依赖zysuyuan-item-entity和zysuyuan-common模块,开发和测试阶段不需要将entity和common模块进行打包发布到maven私服仓库,而当发布项目打包service时,需要将这两个模块entity和common发布到maven私服仓库,否则会造成service打包失败,会提示缺少entity和common的依赖
若发布(deploy)时报以下错误:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) on project SpringCloudUserFeign: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:repackage failed: Unable to find main class -> [Help 1]
解决方案:https://blog.csdn.net/qq_33547169/article/details/78866859
方案一、创建main方法
方案二、添加如下配置
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <phase>none</phase> </execution> </executions> </plugin> </plugins> </build>
使用maven可以方便的开发好的jar包发布到本地仓库中,方便其他项目依赖使用,在pom.xml文件中添加如下的配置:
<distributionManagement> <repository> <id>localRepository</id> <url>file:F:\environment\wwk_repository</url> </repository> </distributionManagement>
即:(总)
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <phase>none</phase> </execution> </executions> </plugin> </plugins> </build> <distributionManagement> <repository> <id>localRepository</id> <!-- 本地仓库地址--> <url>file:F:\environment\wwk_repository</url> </repository> </distributionManagement>