Reputation: 370
Is there a way to append the -SNAPSHOT suffix to the version of a project based on profile? I'd like the prod profile to be the only one able to deploy RELEASES to nexus.
Upvotes: 2
Views: 1311
Reputation: 76
We can use user-defined properties to accomplish this:
<profile>
<id>local</id>
<properties>
<env>local</env>
<snapshot>-SNAPSHOT</snapshot>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<env>prod</env>
<snapshot></snapshot>
</properties>
</profile>
Then update the version to refer to our new property:
<version>0.1.0${snapshot}</version>
Upvotes: 1
Reputation: 1043
They better way to acomplish this is using the maven-release-plugin this will versioning your project and modules and prepare it to the release version saving you from the tedious work.
Upvotes: 0
Reputation: 240900
by configuring different profile do SNAPSHOT build or a RELEASE build is not a good idea, here you are going to make both of them to have same source, (i.e. the source in development would be in release and vice versa)
you should keep only one version at a time, RELEASE it once and increment to the next SNAPSHOT by using mvn release plugin
Upvotes: 0