在我的maven构建中,我希望执行proguard目标在测试之后,以便更快地获得测试结果。因此,我试图将其绑定到prepare-package阶段。然而,我的配置波纹管没有任何影响。保护目标仍然在process-classes阶段(默认保护)中执行。我遗漏了什么?
<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>发布于 2015-03-06 18:46:06
旧的答案:
您不能更改阶段进程保护运行。但通常情况下,您可以隔离到配置文件中,只在需要时运行,而不是在每次构建时运行。典型的用例是只为发行版运行的发布配置文件。您还可以将其作为QA配置文件的一部分,并将其用于开发构建,这些构建需要在开发过程中超出正常使用范围进行验证。
经过一些思考后更新:
通过配置两次执行,您可以将proguard执行更改为不同的阶段。其中一个用于process-sources阶段,这是在Android插件中配置的,将被跳过。然后,将第二次执行配置为期望的阶段,跳过设置为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>https://stackoverflow.com/questions/28842942
复制相似问题