Skip to content

Instantly share code, notes, and snippets.

@robbielynch
Last active December 18, 2015 01:09
Show Gist options
  • Save robbielynch/5701855 to your computer and use it in GitHub Desktop.
Save robbielynch/5701855 to your computer and use it in GitHub Desktop.
Sample Android-Maven pom.xml
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- Information about your module -->
<groupId>com.company.name.goes.here</groupId>
<artifactId>AwesomeArtifactIdHere</artifactId>
<version>1.0</version>
<packaging>apk</packaging>
<!-- Sample properties, where we can store custom variables that we will reuse -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<platform.version>4.1.1.4</platform.version>
<android.plugin.version>3.5.3</android.plugin.version>
<sonar.exclusions>**/GENERATED/**</sonar.exclusions>
<src.directory>src/main/java</src.directory>
<test.directory>src/test/java</test.directory>
<sdk.platform>17</sdk.platform>
</properties>
<!-- A list of sample dependencies that your project will need -->
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${platform.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mockito Mocking Framework -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>provided</scope>
</dependency>
<!-- Robotium -->
<dependency>
<groupId>com.jayway.android.robotium</groupId>
<artifactId>robotium-solo</artifactId>
<version>4.1</version>
</dependency>
<!-- Junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<!-- Build Instructions
- Locations and names of source directory
- Locations and names of test directory
- Locations and names of res directory (ie. Where your images, 9patch, xml files are stored)
- Details about your android installation
- Details about the android-maven plugin -->
<build>
<directory>target</directory>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>${src.directory}</sourceDirectory>
<testSourceDirectory>${test.directory}</testSourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/res</directory>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.3</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<sdk>
<platform>${sdk.platform}</platform>
<!-- Don't forget to change the path of your Android SDK directory -->
<path>PATH_TO_YOUR_ANDROID_SDK_DIRECTORY_HERE</path>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
</plugin>
</plugins>
</build>
</project>
@robbielynch
Copy link
Author

It took me a long time to figure this out, so i thought I'd share it with people who care.... and people who don't. ;)

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