Reputation: 1492
Is there a way to skip plugin execution or activate profile only for snapshot build (and for release build accordingly)?
Upvotes: 2
Views: 1538
Reputation: 2045
Yes - you can do it directly and flexibly.
Define a property which is activated only when Maven release plugin runs. Then have your other plugins check the value of that property to decide whether to run or not.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<preparationGoals>clean install -D release-flag=true</preparationGoals>
<goals>deploy -D release-flag=true</goals>
</configuration>
</plugin>
PS: A similar effect can be achieved using -P release-profile
instead of -D release-flag
Upvotes: 0
Reputation: 97389
You have the distributionManagement tag in your pom.xml file like the following:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
...
<distributionManagement>
<repository>
<id>release</id>
<name>Corporate Repository</name>
<url>http://server.name.com/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Propellors Snapshots</name>
<url>http://server.name.com/snapshots/</url>
</snapshotRepository>
...
</distributionManagement>
...
</project>
Upvotes: 1