Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven release plugin skipping tests on perform but not prepare

Tags:

java

maven

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.

like image 327
moon.mid Avatar asked Mar 13 '14 21:03

moon.mid


People also ask

How does maven release plugin work?

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.

What does mvn release clean do?

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.

What is mvn release prepare?

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.


1 Answers

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>
like image 138
Tome Avatar answered Oct 05 '22 22:10

Tome