diff --git a/src/main/java/com/jayway/maven/plugins/android/phase01generatesources/GenerateSourcesMojo.java b/src/main/java/com/jayway/maven/plugins/android/phase01generatesources/GenerateSourcesMojo.java index 59ae03bcc..716809ba9 100644 --- a/src/main/java/com/jayway/maven/plugins/android/phase01generatesources/GenerateSourcesMojo.java +++ b/src/main/java/com/jayway/maven/plugins/android/phase01generatesources/GenerateSourcesMojo.java @@ -61,9 +61,55 @@ public class GenerateSourcesMojo extends AbstractAndroidMojo { /** - * Override default merging. - * + *

Override default merging. You must have SDK Tools r20+

* @parameter expression="${android.mergeManifests}" default-value="false" + * + *

IMPORTANT: The resource plugin needs to be disabled for the + * process-resources phase, + * so the "default-resources" execution must be added. + * Without this the non-merged manifest will get re-copied to + * the build directory.

+ *

The androidManifestFile should also be + * configured to pull from the build directory so that + * later phases will pull the merged manifest file.

+ *

Example POM Setup:

+ *
+     * <build>
+     *     ...
+     *     <plugins>
+     *         ...
+     *         <plugin>
+     *             <artifactId>maven-resources-plugin</artifactId>
+     *             <version>2.6</version>
+     *             <executions>
+     *                 <execution>
+     *                     <phase>initialize</phase>
+     *                     <goals>
+     *                         <goal>resources</goal>
+     *                     </goals>
+     *                 </execution>
+     *                 <execution>
+     *                     <id>default-resources</id>
+     *                     <phase>DISABLED</phase>
+     *                 </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>
+     *                 <mergeManifests>true</mergeManifests>
+     *             </configuration>
+     *             <extensions>true</extensions>
+     *         </plugin>
+     *         ...
+     *     </plugins>
+     *     ...
+     * </build>
+     * 
*/ protected boolean mergeManifests;