在Maven 3发布期间提交更新的Proguard映射



我使用Maven 3来管理我的Android应用程序的构建和发布周期。在发布期间,使用Proguard maven插件对应用程序源代码进行模糊处理。理想情况下,我希望在发布过程中将更新的Proguard模糊映射提交到git存储库中。我目前将映射附加到推送到发布存储库的工件,但如果可能的话,我希望将映射保持在git中。

最好的方法是什么?

如果我理解正确,您需要将配置传入,因此来自@khmarbaise的解决方案是不够的。我建议在proguard映射创建后立即附加的发布配置文件中使用maven scm插件。

您将希望添加映射文件:http://maven.apache.org/scm/maven-scm-plugin/add-mojo.html

然后办理入住手续http://maven.apache.org/scm/maven-scm-plugin/checkin-mojo.html

也许类似于:

<profiles>
  <profile>
    <id>release</id>
    <activation>
      <property>
        <name>performRelease</name>
        <value>true</value>
      </property>
    </activation>
    <build>
      <plugins>
        <plugin>
          <artifactId>maven-scm-plugin</artifactId>
          ...
          <configuration>
            ... add your scm setup here ...
          </configuration>
          <executions>
            <execution>
              <id>addMap</id>
              <phase>install</phase>
              <goals>
                <goal>add</goal>
              </goals>
            </execution>
            <execution>
              <id>commitMap</id>
              <phase>install</phase>
              <goals>
                <goal>checkin</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
    ...
  </profile>
</profiles>

您可以在提交之前通过文档中描述的maven发布插件运行目标。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.2.2</version>
    <configuration>
      <preparationGoals>clean verify</preparationGoals>
    </configuration>
</plugin>

最新更新