我在我的Java Maven 项目中使用git-crypt ( https://github.com/AGWA/git-crypt ) 来加密包含敏感数据(密码等)的属性文件。
准备发布运行没有问题。但是“mvn release:perform”的执行失败了,因为这个操作是自动化的:
- 从 SCM 结帐发布标签
- 构建和部署发布的代码
问题是,我的属性文件已加密签出,因此某些集成测试的执行失败。
在 release:perform 过程中应该可以以某种方式自动解密我的文件。
我需要这样的解决方案:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>cmd</executable>
<arguments>
<argument>/c</argument>
<argument>git-crypt unlock my-unlock-keyfile</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<completionGoals>exec:exec</completionGoals>
</configuration>
</plugin>
</plugins>
</build>
但遗憾的是,此代码仅适用于准备发布。