When using the maven release plugin, both mvn release:prepare
and mvn release:perform
will run the tests.
Is there any way I can configure things so they only run during mvn release:prepare
?
I know you can pass:
-Darguments="-DskipTests"
But this will skip the tests during both goals, which I don't want. And I also don't want them to run during just mvn release:perform
and not prepare, as a failure during perform will have already tagged the repository.
The main aim of the maven-release plugin is to provide a standard mechanism to release project artifacts outside the immediate development team. The plugin provides basic functionality to create a release and to update the project's SCM accordingly.
mvn release will basically put your current code in a tag on your SCM, change your version in your projects. mvn deploy will put your packaged maven project into a remote repository for sharing with other developers.
mvn release:prepare This command prepares for a release in SCM. It goes through several phases to ensure the POM is ready to be released and then creates a tag in SVN which can be used by release:perform to make a release.
You should be able to do that by adding the <releaseProfiles>
element to the release-plugin configuration. This will only be used for release:perform Mojo.
Something like this should do the trick:
<build>
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<releaseProfiles>skipTestsForReleasePerform</releaseProfiles>
</configuration>
</plugin>
</plugins>
</build>
(...)
<profiles>
<profile>
<id>skipTestsForReleasePerform</id>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
</profiles>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With