Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:Maven最终存档名称_Android_Maven_Jenkins_Android Build_Maven Install Plugin - Fatal编程技术网

Android:Maven最终存档名称

Android:Maven最终存档名称,android,maven,jenkins,android-build,maven-install-plugin,Android,Maven,Jenkins,Android Build,Maven Install Plugin,在mavenmvn clean install运行结束时,maven安装插件会自动将创建的工件安装到存储库中: [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\

在maven
mvn clean install
运行结束时,maven安装插件会自动将创建的工件安装到存储库中:

[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
不幸的是,最终的apk文件名在此过程中被重命名(
project-0.1.1-test.apk
>
project-0.1.1.apk

最初,通过设置apk文件的名称

<finalName>${project.artifactId}-${project.version}-${webservice.target}</finalName>
${project.artifactId}-${project.version}-${webservice.target}
如何在生成归档文件中指定apk文件的最终名称而不覆盖属性本身?

原因: 运行
mvn clean install-X
使Maven在末尾执行
default install
目标,使用默认的groupId:artifactId:packaging:version安装生成的apk(在本例中,我使用
abc-123
作为最终名称):

解决方案: 此默认工件安装既不可避免也不可修改,并且在默认安装目标执行期间,
不会对目标文件名(使用固定模式
工件ID版本分类器。打包
)产生任何影响。解决方案是将额外的工件附加到构建生命周期,具体取决于您的需求(如果您只需要在
myapp-1.2.2-SNAPSHOT
后面添加一些后缀),最简单的方法是在android maven插件配置中定义:

<plugin>
  <groupId>com.jayway.maven.plugins.android.generation2</groupId>
  <artifactId>android-maven-plugin</artifactId>
  <extensions>true</extensions>
  <configuration>
    <classifier>test</classifier>
    ... ...
  </configuration>
</plugin>
<plugin>
  <groupId>com.jayway.maven.plugins.android.generation2</groupId>
  <artifactId>android-maven-plugin</artifactId>
  <extensions>true</extensions>
  <configuration>
    <classifier>test</classifier>
    ... ...
  </configuration>
</plugin>
[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