sajith4u / maven-android-plugin

Automatically exported from code.google.com/p/maven-android-plugin
0 stars 0 forks source link

Manifest-merge modifies original source file #401

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create library project with activity/service/receiver declarations
2. Create app project that inherits from library 
3. Add "mergeManifests" element to app project POM:

<build>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <configuration>
                <mergeManifests>true</mergeManifests>
            </configuration>
            <extensions>true</extensions>
        </plugin>
    </plugins>
</build>

What is the expected output?
Generated app manifest should include merged declarations from library. 
Original AndroidManifest.xml source should not be modified. 

What do you see instead?
Manifest:merge updates the source manifest, meaning duplicate activity 
declarations appear in the codebase. 
Diff below shows change in manifest before and after build (using sample 
project: http://code.google.com/p/maven-android-plugin/wiki/Samples).

diff --git a/libraryprojects-mainapp/AndroidManifest.xml 
b/libraryprojects-mainapp/AndroidManifest.xml
index 65c9a6a..00cb723 100644
--- a/libraryprojects-mainapp/AndroidManifest.xml
+++ b/libraryprojects-mainapp/AndroidManifest.xml
@@ -1,15 +1,22 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      
package="com.jayway.maven.plugins.android.generation2.samples.libraryprojects.ma
inapp"
-      android:versionCode="1"
-      android:versionName="1.0">
-    <application android:label="@string/app_name" 
android:icon="@drawable/icon">
-        <activity android:name="MainActivity"
-                  android:label="@string/app_name">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
android:versionCode="1" android:versionName="1.0" 
package="com.jayway.maven.plugins.android.generation2.samples.libraryprojects.ma
inapp">
+    <application android:icon="@drawable/icon" 
android:label="@string/app_name">
+        <activity android:label="@string/app_name" 
android:name="com.jayway.maven.plugins.android.generation2.samples.libraryprojec
ts.mainapp.MainActivity">
             <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+        <activity android:label="@string/app_name" 
android:name="com.jayway.maven.plugins.android.generation2.samples.libraryprojec
ts.lib1.ACTIVITY_ENTRY_NAME">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+        <activity android:label="@string/app_name" 
android:name="com.jayway.maven.plugins.android.generation2.samples.libraryprojec
ts.lib2.ACTIVITY_ENTRY_NAME">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
             </intent-filter>
         </activity>
     </application>
-</manifest> 
+</manifest>

What version of maven-android-plugin are you using?
3.6.0

What are the complete output lines of "mvn -version" on your machine?
Apache Maven 3.0.4 (r1232337; 2012-01-17 08:44:56+0000)
Maven home: /usr/share/maven
Java version: 1.6.0_51, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"

Please provide any additional information below.

Original issue reported on code.google.com by dan.haw...@spaggetti.co.uk on 23 Jun 2013 at 9:41

GoogleCodeExporter commented 9 years ago
Please check whether this is fixed with the latest 3.8.3-SNAPSHOT.

Example config:
<sourceManifestFile>${project.basedir}/src/AndroidManifest.xml</sourceManifestFi
le>
<androidManifestFile>${project.build.directory}/AndroidManifest.xml</androidMani
festFile>

Original comment by malac...@gmail.com on 17 Feb 2014 at 4:15

GoogleCodeExporter commented 9 years ago
We are no longer using the issue tracking system on Google Code. Please refile 
this issue on https://github.com/jayway/maven-android-plugin/issues if you 
still have this problem with the latest release of the Android Maven Plugin

Original comment by mosa...@gmail.com on 19 May 2014 at 4:20