Skip to content

Instantly share code, notes, and snippets.

@pestrada
Last active December 17, 2015 06:58
Show Gist options
  • Save pestrada/5568772 to your computer and use it in GitHub Desktop.
Save pestrada/5568772 to your computer and use it in GitHub Desktop.
Sample POM file for the parent folder of an Android project managed with Maven.
<?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>
<groupId>com.your_company.package</groupId>
<artifactId>your_parent_artifact_id</artifactId>
version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>your-library1</module>
<module>your-library2</module>
<module>your-application-project</module>
<module>your-application-tests</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>4.1.1.4</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<sdk>
<path>${env.ANDROID_HOME}</path>
<platform>16</platform>
</sdk>
</configuration>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<profiles>
<!-- MSOURCES-13 related workaround overriding super-pom.
http://blog.peterlynch.ca/2010/05/maven-how-to-prevent-generate-sources.html -->
<profile>
<id>release-profile</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<artifactId>maven-source-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>attach-sources-no-fork</id>
<inherited>true</inherited>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment