Cause:
Running mvn clean install -X causes Maven to run the default-install command at the end of the build life cycle , which use the default groupId: artifactId: packaging: version install generated apk (I use abc-123 as the final name in this example ):
[INFO] --- maven-install-plugin:2.1:install (default-install) @ myapp --- [DEBUG] Configuring mojo org.apache.maven.plugins:maven-install-plugin:2.1:install from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.1, parent: sun.misc.Launcher$AppClassLoader@11b86e7 ] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-install-plugin:2.1:install' with basic configurator --> [DEBUG] (f) artifact = com.mycompany:myapp:apk:1.2.2-SNAPSHOT [DEBUG] (f) attachedArtifacts = [com.mycompany:myapp:jar:1.2.2-SNAPSHOT] [DEBUG] ... ... [DEBUG] -- end configuration -- [INFO] Installing C:\workspace\myapp\target\abc-123.apk to c:\maven\repository\com\mycompany\myapp\1.2.2-SNAPSHOT\myapp-1.2.2-SNAPSHOT.apk [INFO] ... ...
Decision:
This default setting for AFAIK artifacts is not prohibited or modified, and <finalName> does not affect the name of the target file (which uses the fixed artifactId-version-classifier.packaging template) during the execution of the default installation target. The solution adds an additional artifact to the build life cycle, depending on your demand (if you only need to add a suffix for myapp-1.2.2-SNAPSHOT ), the easiest way is to define a classifier in the android-maven-plugin configuration:
<plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <extensions>true</extensions> <configuration> <classifier>test</classifier> ... ... </configuration> </plugin>
This will cause myapp-1.2.2-SNAPSHOT.apk and myapp-1.2.2-SNAPSHOT-test.apk to be installed in the maven repository:
[INFO] --- maven-install-plugin:2.1:install (default-install) @ myapp --- [DEBUG] Configuring mojo org.apache.maven.plugins:maven-install-plugin:2.1:install from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-install-plugin:2.1, parent: sun.misc.Launcher$AppClassLoader@11b86e7 ] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-install-plugin:2.1:install' with basic configurator --> [DEBUG] (f) artifact = com.mycompany:myapp:apk:1.2.2-SNAPSHOT [DEBUG] (f) attachedArtifacts = [com.mycompany:myapp:jar:1.2.2-SNAPSHOT, com.mycompany:myapp:apk:test:1.2.2-SNAPSHOT] [DEBUG] ... ... [DEBUG] -- end configuration -- [INFO] Installing C:\workspace\myapp\target\abc-123.jar to c:\maven\repository\com\mycompany\myapp\1.2.2-SNAPSHOT\myapp-1.2.2-SNAPSHOT.apk [INFO] ... ... [INFO] Installing C:\workspace\myapp\target\abc-123.apk to c:\maven\repository\com\mycompany\myapp\1.2.2-SNAPSHOT\myapp-1.2.2-SNAPSHOT-test.apk
yorkw source share