Created
May 13, 2013 14:48
-
-
Save pestrada/5568848 to your computer and use it in GitHub Desktop.
Sample POM file for the application folder of an Android project managed with Maven.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<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/maven-v4_0_0.xsd"> | |
<parent> | |
<groupId>com.your_company.package</groupId> | |
<artifactId>your_parent_artifact_id</artifactId> | |
<version>1.0.0-SNAPSHOT</version> | |
</parent> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>your-application-project</artifactId> | |
<packaging>apk</packaging> | |
<dependencies> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>3.8.2</version> | |
</dependency> | |
<dependency> | |
<groupId>com.google.android</groupId> | |
<artifactId>android</artifactId> | |
<scope>provided</scope> | |
</dependency> | |
<dependency> | |
<groupId>com.google.android</groupId> | |
<artifactId>support-v4</artifactId> | |
<version>r6</version> | |
</dependency> | |
<dependency> | |
<groupId>com.your_library.package</groupId> | |
<artifactId>your-library-name</artifactId> | |
<version>1</version> | |
<scope>compile</scope> | |
<type>apklib</type> | |
</dependency> | |
</dependencies> | |
<build> | |
<finalName>${project.artifactId}</finalName> | |
<sourceDirectory>src</sourceDirectory> | |
<plugins> | |
<plugin> | |
<artifactId>maven-resources-plugin</artifactId> | |
<version>2.6</version> | |
<executions> | |
<execution> | |
<id>copy-manifest</id> | |
<phase>initialize</phase> | |
<goals> | |
<goal>copy-resources</goal> | |
</goals> | |
<configuration> | |
<outputDirectory>${project.build.directory}</outputDirectory> | |
<resources> | |
<resource> | |
<directory>${project.basedir}</directory> | |
<includes> | |
<include>AndroidManifest.xml</include> | |
</includes> | |
</resource> | |
</resources> | |
<overwrite>true</overwrite> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<groupId>com.jayway.maven.plugins.android.generation2</groupId> | |
<artifactId>android-maven-plugin</artifactId> | |
<configuration> | |
<androidManifestFile>${project.build.directory}/AndroidManifest.xml</androidManifestFile> | |
<manifest> | |
<versionName /> | |
<versionCodeUpdateFromVersion>true</versionCodeUpdateFromVersion> | |
</manifest> | |
<mergeManifests>true</mergeManifests> | |
</configuration> | |
<executions> | |
<execution> | |
<id>update-manifest</id> | |
<phase>initialize</phase> | |
<goals> | |
<goal>manifest-update</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
<profiles> | |
<profile> | |
<id>sign</id> | |
<activation> | |
<!-- via this activation the profile is automatically used when the release is done with the maven release plugin --> | |
<property> | |
<name>performRelease</name> | |
<value>true</value> | |
</property> | |
</activation> | |
<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> | |
<goal>verify</goal> | |
</goals> | |
<phase>package</phase> | |
<inherited>true</inherited> | |
<configuration> | |
<removeExistingSignatures>true</removeExistingSignatures> | |
<archiveDirectory /> | |
<includes> | |
<include>target/*.apk</include> | |
</includes> | |
<storetype>${keystore.type}</storetype> | |
<keystore>${keystore.path}</keystore> | |
<storepass>${keystore.store.password}</storepass> | |
<keypass>${keystore.key.password}</keypass> | |
<alias>${keystore.alias}</alias> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<!-- the signed apk then needs to be zipaligned --> | |
<plugin> | |
<groupId>com.jayway.maven.plugins.android.generation2</groupId> | |
<artifactId>android-maven-plugin</artifactId> | |
<inherited>true</inherited> | |
<configuration> | |
<sign> | |
<debug>false</debug> | |
</sign> | |
<zipalign> | |
<verbose>false</verbose> | |
</zipalign> | |
</configuration> | |
<executions> | |
<execution> | |
<id>alignApk</id> | |
<goals> | |
<goal>zipalign</goal> | |
</goals> | |
<phase>package</phase> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
</profile> | |
</profiles> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment