- Spring cloud项目下子父项目升级时编译依赖问题(统一升级版本)
所有子项目添加 <relativePath>../../pom.xml</relativePath>
- 统一编译 聚合子项目(举例)
<modules>
<module>software</module>
<module>software/util</module>
<module>base</module>
<module>test</module>
<module>web-demo</module>
<module>software/validate</module>
<module>software/export</module>
<module>software/activiti</module>
<module>software/pay</module>
<module>service</module>
<module>service/mcode-base</module>
<module>service/mcode-service</module>
<module>service/mcode-core</module>
<module>service/mcode-web</module>
</modules>
3.统一版本控制
<dependencyManagement>
<dependency>
<groupId>com.bc.mcode.springboot</groupId>
<artifactId>web-demo</artifactId>
<version>${mcode.cloud.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
4.自动部署 至snapshots
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://172.16.1.70:9000/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://172.16.1.70:9000/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
5.代理中央仓库问题
<repositories>
<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>http://172.16.1.70:9000/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus Plugin Repository</name>
<url>http://172.16.1.70:9000/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
6.关于打包的问题
<!-- 注意此处打包方式的不同 1.项目中引入的jar很小 2.独立运行的 web 版本 jar 包-->
<!-- 发布 项目中引入的 jar 包 -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes><!-- -->
<exclude>/*.properties</exclude>
<exclude>/*.xml</exclude>
<exclude>/sigar/**</exclude>
<exclude>/com/bc/mcode/config/**</exclude>
<exclude>/com/bc/mcode/*.class</exclude>
<exclude>/com/bc/mcode/test/*.class</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<!--发布 项目中引入的 jar 包 完毕-->
<!-- 发布 可以执行的 jar 包 -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.4.2.RELEASE</version>
<configuration>
<mainClass>com.bc.mcode.MainStarter</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/webapp</directory>
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/**</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
</build>
网友评论