当我和我的团队不得不将新的Maven工件发布到中心时,我们使用的过程是:
mvn release:clean
mvn release:prepare
mvn release:perform
一切正常。
当然,pom.xml
包含对Maven gpg
插件的引用以密封罐子。
...
<build>
<plugins>
....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
....
</plugins>
</build>
....
或者mvn release:perform
失败:
但是在开发过程中,我们中有些人没有/没有安装gpg.exe
程序或签名密钥(只有主开发人员才具有正确的密封最终jar的程序)。
因此,如果我们在本地执行mvn clean install
或其他类型的命令,则该过程将失败,并且在开发时无法将本地修改的jar放入.m2
文件夹中。
仅在执行命令mvn release:perform
时执行che软件包签名的最佳实践是什么?
答案 0 :(得分:0)
发布和签名工件已经解决。您可以使用将激活符号插件的配置文件。在https://blog.sonatype.com/2010/01/how-to-generate-pgp-signatures-with-maven/上可以找到更多详细信息和故事。
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>