Dave
Dave

Reputation: 8897

Maven: Create a profile to deploy snapshots

I'm using Maven 3.0.3. How would I create a profile such that if I include the profile when deploying, deploying will only succeed if the version is a non-release (e.g. snapshot) version. Otherwise, specifying the profile when launching the deploy should fail.

Thanks for your help, - Dave

Upvotes: 2

Views: 654

Answers (1)

Ryan Stewart
Ryan Stewart

Reputation: 128829

How about using an antrun or GMaven execution to check the ${project.version} and fail the build if it isn't acceptable?

Edit: Clarification: Antrun: Use the antrun plugin to check ${project.version} and call the fail task if it's not a snapshot version. This will fail the maven build. Something like:

<condition property="failme">
    <contains string="${project.version}" substring="SNAPSHOT"/>
</condition>
<fail if="failme" message="hi there!"/>

GMaven: There are specific instructions for failing a build from GMaven. I'm pretty sure you can access the property simply using project.properties['version'].

Upvotes: 2

Related Questions