gpt4 book ai didi

android-maven-plugin:将proguard绑定(bind)到后期

转载 作者:行者123 更新时间:2023-11-29 17:40:51 25 4
gpt4 key购买 nike

在我的 Maven 构建中,我想执行 proguard目标 after the tests ,以便更快地得到测试结果。因此,我尝试将其绑定(bind)到 prepare-package 阶段。但是,我的配置波纹管没有任何效果。 proguard 目标仍然在 process-classes 阶段执行(default-proguard)。我错过了什么?

<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>4.1.0</version>
<executions>
<execution>
<id>progurad-after-test</id>
<phase>prepare-package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- ... -->
<proguard>
<skip>false</skip>
</proguard>
</configuration>
</plugin>

最佳答案

旧答案:

您不能更改混淆器运行的阶段。但通常您可以隔离到一个配置文件中,以便仅在需要时运行,而不是在每次构建时运行。典型的用例是您仅为发布运行的发布配置文件。您还可以将其作为 QA 配置文件的一部分,并将其用于需要在开发过程中超出正常使用范围进行验证的开发构建。

思考后更新:

您可以通过配置两个执行来将 proguard mojo 执行更改为不同的阶段。一个用于 process-sources 阶段,最初在 Android Maven 插件中配置为被跳过。然后为所需阶段配置第二次执行,并将 skip 设置为 false。

<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>4.1.0</version>
<executions>
<execution>
<!-- Skip proguard in the default phase (process-classes)... -->
<id>override-default</id>
<configuration>
<proguard>
<skip>true</skip>
</proguard>
</configuration>
</execution>
<execution>
<!-- But execute proguard after running the tests
Bind to test phase so proguard runs before dexing (prepare package phase)-->
<id>progurad-after-test</id>
<phase>test</phase>
<goals>
<goal>proguard</goal>
</goals>
<configuration>
<proguard>
<skip>false</skip>
</proguard>
</configuration>
</execution>
</executions>
<configuration>
<!-- Other configuration goes here. -->
</configuration>
</plugin>

关于android-maven-plugin:将proguard绑定(bind)到后期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28842942/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com