I have set up some automation to perform maven semantic versioining using maven release plugin. As such i am using the below :-
mvn -B clean release:clean -DpreparationGoals=clean release:prepare -Darguments="-DskipTests" -Darguments="-DskipITs" -Darguments="-Dmaven.javadoc.skip=true" release:perform -Dusername=$GIT_USERNAME -Dpassword=$GIT_PASSWORD
Everything works great except for the fact that during perform phase, i still see the TESTS being executed in our jenkins logs. I am wondering what would be the best way to skip any kind of tests during this maven release prepare and perform without having to make any changes in existing pom.xml as i would like to enforce that through maven arguments passed as CLI arguments so that we don't have to update 1000 of poms using this automation Any help or suggestions here would be greatly appreciated as always.
You can use the arguments
property to do this. Quoting can be very important.
Example:
mvn release:prepare ... -Darguments="-Dmaven.test.skip=true -DsomethingElse=whatever"
Here, I pass the maven.test.skip
property (defined by the maven-surefire-plugin
's test
goal) through to the execution of mvn
run by the prepare
goal of the maven-release-plugin
.