Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.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插件:将proguard绑定到后期_Android_Maven_Android Build_Android Maven Plugin - Fatal编程技术网

android maven插件:将proguard绑定到后期

android maven插件:将proguard绑定到后期,android,maven,android-build,android-maven-plugin,Android,Maven,Android Build,Android Maven Plugin,在我的maven构建中,我希望执行目标,以便更快地获得测试结果。因此,我尝试将其绑定到preparepackage阶段。然而,我的配置吼叫没有任何效果。proguard目标仍在过程类阶段执行(默认proguard)。我错过了什么 <plugin> <groupId>com.simpligility.maven.plugins</groupId> <artifactId>android-maven-plugin</artifac

在我的maven构建中,我希望执行目标,以便更快地获得测试结果。因此,我尝试将其绑定到
preparepackage
阶段。然而,我的配置吼叫没有任何效果。proguard目标仍在
过程类
阶段执行(默认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>

com.simpligility.maven.plugins
安卓maven插件
4.1.0
试验后进展
准备包装
前卫
假的
旧答案:

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

经过思考后更新:

通过配置两个执行,可以将proguard mojo执行更改为不同的阶段。一个用于过程源阶段,最初在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>

com.simpligility.maven.plugins
安卓maven插件
4.1.0
覆盖默认值
真的
试验后进展
测试
前卫
假的

我担心您会说这是不可能的,因为我在网上看到了这个解决方案。不过,谢谢你说得清楚@施纳特尔我想你终究能做到。您必须配置两次执行。一个设置为跳过,覆盖插件中内置的设置,另一个设置为添加新执行。我还没有测试过这个,但它可能会工作。好主意,它实际上是工作的!你能把这个作为一个单独的答案吗?我宁愿把那个答案标为已被接受;-)我可以在你的答案中填写对我有用的XML