一.maven 通过在父项目中配置起到直接打包下面的子项目
1.首先在父项目中添加
<packaging>pom</packaging>
如下:
<groupId>com.springcloud_project</groupId>
<artifactId>springcloud_project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
2.在父项目中要引用子模块的moudles
<modules>
<module>eurekaregister</module>
<module>config-server</module>
<module>adminserver</module>
<module>serverconsumer</module>
<module>serverprovider</module>
<module>springcloud-common</module>
<module>zuul</module>
</modules>
3.将所有子项目的
<parent></parent> 都删除掉,换成父项目的../pom.xml的路径
<parent>
<groupId>com.springcloud_project</groupId>
<artifactId>springcloud_project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
4.通过命令mvn install 可以打包到本地仓库,项目直接从本地仓库引用,但是这里有坑,在test打包,死活都会报错
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project xxx: There are test failures
在网上查找资料获悉,可以使用命令: mvn install -Dmaven.test.skip=true打包就没问题了。
参考
https://blog.csdn.net/u010515155/article/details/78458232