Signing APK with the Maven-Jar-Signer Plugin

April 17th, 2010 by

There is a nice Maven plugin helping you signing your Android app – the Maven Jar Signer Plugin. If you want to learn more about Maven integration in an android project take a look at this article.

Steps:

  • Add the following code to your pom.xml
    <profiles>
     <profile>
     <id>sign</id>
     <build>
     <plugins>
     <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-jarsigner-plugin</artifactId>
     <version>1.2</version>
     <executions>
     <execution>
     <id>signing</id>
     <goals>
     <goal>sign</goal>
     </goals>
     <phase>package</phase>
     <inherited>true</inherited>
     <configuration>
     <archiveDirectory></archiveDirectory>
     <includes>
     <include>target/*.apk</include>
     </includes>
     <keystore>path/to/keystore</keystore>
     <storepass>storepasword</storepass>
     <keypass>keypassword</keypass>
     <alias>key-alias</alias>
     </configuration>
     </execution>
     </executions>
     </plugin>
     <plugin>
     <groupId>com.jayway.maven.plugins.android.generation2</groupId>
     <artifactId>maven-android-plugin</artifactId>
     <inherited>true</inherited>
     <configuration>
     <sign>
     <debug>false</debug>
     </sign>
     </configuration>
     </plugin>
     </plugins>
     </build>
     </profile>
    </profiles>
  • Trigger the profile with the following command
    mvn install -Psign

Useful goals:

  • jarsigner:sign – signs your project’s artifacts
  • jarsigner:verify – verifies the project’s artifact

Useful command line options:

  • Disable the plugin
    mvn -Djarsigner.skip=true
  • Disable attachment processing
    mvn -Djarsigner.attachments=false

More information:

Tags: , , , , , , ,

One Response to “Signing APK with the Maven-Jar-Signer Plugin”

  1. Automating android application signing and zipaligning with maven | James Elsey Says:

    [...] has already been covered, in a useful post by the guys at Novoda, and various other blog posts scattered around the web. I’ve followed at least 10 tutorials and each time I was unable to [...]

Leave a Reply

Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 80,993 bad guys.

Search
Categories