At the end of a maven mvn clean install
run, the created artifacts are automatically installed in the repository by the maven-install-plugin:
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ project ---
[INFO] Installing C:\Users\mannaz\workspace\project\target\project-0.1.1-test.apk to C:\Users\mannaz\.m2\repository\at\mannaz\android\project\0.1.1\project-0.1.1.apk
[INFO] Installing C:\Users\mannaz\workspace\project\pom.xml to C:\Users\mannaz\.m2\repository\at\mannaz\android\project\0.1.1\project-0.1.1.pom
[INFO] Installing C:\Users\mannaz\workspace\project\target\project-0.1.1-test.jar to C:\Users\mannaz\.m2\repository\at\mannaz\android\project\0.1.1\project-0.1.1.jar
Unfortunately the final apk filename is renamed during this process (project-0.1.1-test.apk
>>project-0.1.1.apk
).
Initially the name of the apk file is set via
<finalName>${project.artifactId}-${project.version}-${webservice.target}</finalName>
How can I specify the final name of the apk file in the build archive without overriding the <version/>
attribute itself?
Reason:
Running
mvn clean install -X
cause Maven executedefault-install
goal at the end of the build life cycle, which use the default groupId:artifactId:packaging:version install the generated apk (I useabc-123
as the final name in this example):Solution:
This default artifact install is AFAIK neither avoidable nor modifiable, and the
<finalName>
doesn't take any effect on the target file name (which use a fixed patternartifactId-version-classifier.packaging
) during the default-install goal execution. The solution is attach extra artifact to the build life cycle, depend on you demand (If you only need add some suffix behindmyapp-1.2.2-SNAPSHOT
), the easiest way is define a classifier in android-maven-plugin configuration:This will cause both myapp-1.2.2-SNAPSHOT.apk and myapp-1.2.2-SNAPSHOT-test.apk get installed into maven repository: