批量级联更新maven父子模块版本号
mvn versions:set -DnewVersion=4.1.1-yfd-1.0 -DgenerateBackupPoms=false
checkstyle
mvn checkstyle:check
test
端口
-Dmaven.surefire.debug
使用Idea里的mvn
export MAVEN_HOME=’/Applications/IntelliJ\ IDEA\ CE.app/Contents/plugins/maven/lib/maven3’
export PATH=$PATH:$MAVEN_HOME/bin
chmod 777 /Applications/IntelliJ\ IDEA\ CE.app/Contents/plugins/maven/lib/maven3/bin/mvn
组合代替继承(import)
<dependency>
<groupId>com.fenbi</groupId>
<artifactId>commons-parent</artifactId>
<version>2021.08.1-BETA</version>
<scope>import</scope>
<type>pom</type>
</dependency>
SpringBoot打包fatjar
<build>
<finalName>data-migration-manager</finalName>
<plugins>
<!-- spring-boot:repackage,默认goal。在mvn package之后,再次打包可执行的jar/war,同时保留mvn package生成的jar/war为.origin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.7.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
版本仲裁
A 依赖了 B,A依赖了C的c1版本,B依赖了C的c2版本。
如果pom中只引入了A,那么C的版本为c1。
如果pom中同时引入了A和B,并且A在pom文件中的顺序更靠前,那么C的版本为c1。
如果pom中同时引入了A和B,并且B在pom文件中的顺序更靠前,那么C的版本为c2。
注意,如果A和B都是放在parent中的,自己的pom里引用了parent里的A和B。那么此时pom文件顺序其实是看自己的pom,而不是看parent pom。