Skip to content

Instantly share code, notes, and snippets.

@kamilolesiejuk
Created August 12, 2010 14:18
Show Gist options
  • Save kamilolesiejuk/521029 to your computer and use it in GitHub Desktop.
Save kamilolesiejuk/521029 to your computer and use it in GitHub Desktop.
Novoda blog: Android CI
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>novoda.weeworld</groupId>
<artifactId>weeworld-dev</artifactId>
<version>1.14.0_lmh</version>
</parent>
<artifactId>weeworld</artifactId>
<packaging>apk</packaging>
<name>WeeWorld Avatar Creator</name>
<description>WeeWorld Avatar Creator Android Application</description>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!--default case. acts when no profile selected-->
<!-- the application gets installed into the local maven repository so that the instrumentation test project can use it-->
<build>
<defaultGoal>install</defaultGoal>
<finalName>${project.artifactId}-${project.version}</finalName>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
<!-- needs additional config/parameters to work: a keystore along with access data to it.
parameters for the keystore as seen below-->
<profiles>
<profile><!-- release profile. uses keystore defined in keystore.* properties. signs and zipaligns the app to the target folder-->
<id>release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<defaultGoal>install</defaultGoal>
<finalName>${project.artifactId}-${project.version}</finalName>
<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>
<includes>
<include>${project.build.directory}/target/${project.artifactId}-${project.version}.apk</include>
</includes>
<keystore>${keystore.location}</keystore>
<storepass>${keystore.password}</storepass>
<keypass>${keystore.keypass}</keypass>
<alias>${keystore.alias}</alias>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<configuration>
<zipalign>
<verbose>true</verbose>
<skip>false</skip><!-- defaults to true -->
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
<outputApk>${project.build.directory}/WeeWorld_v${project.version}.apk</outputApk>
</zipalign>
<sign>
<debug>false</debug>
</sign>
</configuration>
<executions>
<execution>
<id>zipalign</id>
<phase>verify</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile><!-- builds an unsigned apk-->
<id>unsign</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<defaultGoal>install</defaultGoal>
<finalName>WeeWorld_v${project.version}_unsigned</finalName>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<configuration>
<sign>
<debug>false</debug>
</sign>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>novoda.weeworld</groupId>
<artifactId>weeworld-dev</artifactId><!--artifactId for both the app and the instrumentation - a development package-->
<version>1.14.0_lmh</version>
<packaging>pom</packaging>
<name>WeeWorld app and instrumentation</name>
<description>WeeWorld avatar creator android application and its intrumentation</description>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<!-- build all profile -->
<profile>
<id>all</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>WeeWorld</module>
<module>WeeWorldTest</module>
</modules>
</profile>
<!-- App build profile -->
<profile>
<id>app-build</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules> <!--we are only building the application here -->
<module>WeeWorld</module>
</modules>
</profile>
<!-- Instrumentation test profile -->
<profile>
<id>instrument</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<modules>
<module>WeeWorldTest</module>
</modules>
</profile>
<!--sign and release profile -->
<profile>
<id>release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<modules>
<module>WeeWorld</module>
</modules>
</profile>
</profiles>
<!--default settings common to all profiles unless overriden -->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<configuration>
<sdk>
<platform>8</platform>
</sdk>
<deleteConflictingFiles>true</deleteConflictingFiles>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>novoda.weeworld</groupId>
<artifactId>weeworld-dev</artifactId>
<version>1.14.0_lmh</version>
</parent>
<artifactId>weeworld-test</artifactId>
<packaging>apk</packaging>
<name>WeeWorld Avatar Creator Instrumentation</name>
<description>WeeWorld Avatar Creator Android Application's Instrumention</description>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<!-- the target apk, which we will test. will automatically be deployed to device in pre-integration-test phase. -->
<groupId>novoda.weeworld</groupId>
<artifactId>weeworld</artifactId>
<version>${project.version}</version>
<type>apk</type>
</dependency>
<dependency>
<!-- optional: compile time dependency, in this case so that we can read from the R.java for example. -->
<groupId>novoda.weeworld</groupId>
<artifactId>weeworld</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<finalName>${project.artifactId}-${project.version}</finalName>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<testSourceDirectory></testSourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<configuration>
<emulator>
<avd>22</avd> <!-- name of the avd to deploy to and run the instrumentation on -->
<wait>150000</wait> <!-- wait time for the emulator to start -->
<options>-partition-size 128 -wipe-data</options> <!-- additional options to run the emulator with-->
</emulator>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<executions> <!-- android plugin execution that starts the emulator bound to the 'initialize' goal -->
<execution>
<id>startemulator</id>
<phase>initialize</phase>
<goals>
<goal>emulator-start</goal>
</goals>
</execution>
<execution>
<id>stopemulator</id>
<phase>install</phase>
<goals>
<goal>emulator-stop</goal>
</goals>
</execution>
</executions>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
@jeremywadsack
Copy link

Note that under maven-android-plugin 1.1.1 you need to set the apk version of the app under test dependency to provided. See http://code.google.com/p/maven-android-plugin/issues/detail?id=159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment