i use versions-maven-plugin update projects version. want install artifact updated version maven-install plugin uses old version. how have configure project achieve described behaviour?
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>build-helper-maven-plugin</artifactid> <executions> <execution> <phase>validate</phase> <goals> <goal>parse-version</goal> </goals> </execution> </executions> <configuration> <propertyprefix>parsedversion</propertyprefix> </configuration> </plugin> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>versions-maven-plugin</artifactid> <executions> <execution> <id>update-version</id> <phase>validate</phase> <goals> <goal>set</goal> <goal>commit</goal> </goals> <configuration> <newversion>${parsedversion.majorversion}.${parsedversion.minorversion}.${parsedversion.incrementalversion}-${svn_revision}</newversion> </configuration> </execution> </executions> </plugin>
normally expect concerning maven lifecycle install plugin should take new version because version plugin executed in phase validate.
starting maven 3.2.1 there possibility use properties versions means can give things in pom file:
<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"> <modelversion>4.0.0</modelversion> <parent> <groupid>com.soebes.smpp</groupid> <artifactid>smpp</artifactid> <version>2.2.1</version> </parent> <groupid>com.soebes.examples.j2ee</groupid> <artifactid>parent</artifactid> <version>${revision}</version> <packaging>pom</packaging>
furthermore can of course in parent element of multi module build this:
<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"> <modelversion>4.0.0</modelversion> <parent> <groupid>com.soebes.examples.j2ee</groupid> <artifactid>parent</artifactid> <version>${revision}</version> </parent> <artifactid>service</artifactid> <packaging>ejb</packaging>
this means in consequence can run maven via this:
mvn -drevision=1.2.3-snapshot install
or release simply:
mvn -drevision=1.2.3 install
the drawback here need give revision on command line or in ci jobs. apart possible use furthermore other things ${changelist}
or ${sha1}
can of course use in combination. can adopt suggestions this:
<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"> <modelversion>4.0.0</modelversion> <parent> <groupid>com.soebes.smpp</groupid> <artifactid>smpp</artifactid> <version>2.2.1</version> </parent> <groupid>com.soebes.examples.j2ee</groupid> <artifactid>parent</artifactid> <version>${revision}-${sha1}</version> <packaging>pom</packaging>
so can call maven via this:
mvn -drevision=1.2.3 -dsha1=svnrevision-snapshot clean package
Comments
Post a Comment