0

I need a way to set a property is.snapshot to 0 if project is currently a SNAPSHOT version, otherwise set the property to 1.

My attempt was to use the build-helper-plugin

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.7</version>
                    <executions>
                        <execution>
                            <id>version-helper</id>
                            <goals>
                                <goal>regex-property</goal>
                            </goals>                                
                        </execution>
                    </executions>
                    <configuration>
                        <name>is.snapshot</name>
                        <value>${project.version}</value>
                        <regex>.*(-SNAPSHOT)$</regex>
                        <replacement>0</replacement>
                        <failIfNoMatch>false</failIfNoMatch>
                    </configuration>
                </plugin>   

If project.version is SNAPSHOT the is.snapshot property is set to 0. This works fine. However, if project.version is not a SNAPSHOT the property gets set to the project.version.

Any way to correct this or is there another plugin I could use?

blong
  • 2,815
  • 8
  • 44
  • 110
DarVar
  • 16,882
  • 29
  • 97
  • 146
  • What is the purpose of that? Or for what do you need such things? – khmarbaise May 22 '13 at 15:23
  • For building an rpm. For the rpm version I want to use major.minor.service. For rpm release I want to use 0 for SNAPSHOT or 1 for release – DarVar May 23 '13 at 11:11
  • You know that the [rpm-maven-plugin](http://mojo.codehaus.org/rpm-maven-plugin/) already has such a mechanism? – khmarbaise May 23 '13 at 11:15
  • I'm using the rpm-maven-plugin but the problem for me is how can I set the release to 0 when version is a SNAPSHOT and to 1 when not. The plugin sets rpm release to utc timestamp for snapshot which I don't want – DarVar May 23 '13 at 18:29
  • In case of a SNAPSHOT why is it such a big issue ? Why not using the timestamp? – khmarbaise May 24 '13 at 10:16

1 Answers1

-1

You can set the the release version of the rpm-maven-plugin manually if you really need it.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235