Skip to content

Instantly share code, notes, and snippets.

@kingargyle
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingargyle/c9e11a873f229832f299 to your computer and use it in GitHub Desktop.
Save kingargyle/c9e11a873f229832f299 to your computer and use it in GitHub Desktop.
Update Version Number in AndroidManifest with POM version number.
<!--
Include the following snippet in a profile or as part of your standard build.
It will parse out the POM version number and then use it to update the
version number in your AndroidManfiest.xml. It will also increment the
versionCode based on the version number.
No more manually having to update the vesion number as part of a release!! Yipee!
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>parse-version</id>
<goals>
<goal>parse-version</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>update-version-number</id>
<goals>
<goal>manifest-update</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<manifest>
<versionName>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${maven.build.timestamp}</versionName>
<versionCodeUpdateFromVersion>true</versionCodeUpdateFromVersion>
</manifest>
</configuration>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment