Maven 项目中的 Jar 签名策略
我们有几个 Maven 项目,它们是在构建服务器上构建的。在某些情况下,我们希望签署我们的交付成果。我们使用 Maven Jarsigner 插件 来做到这一点。
我们面临以下问题:
- 我们应该将签名密码存储在哪里?
- 签署 Maven 项目的好策略是什么?
我们不想将密钥库放在服务器上的某个位置并硬编码它的路径。因此,我们只是将此密钥库包装在一个 jar 中,并将其作为工件上传到我们的内部 Maven 存储库。当我们想要签署 Maven 项目时,我们使用 Maven 依赖插件< /a> 并将签名目标附加到 Maven 构建生命周期。 这里更详细信息。
为了隐藏密钥库的密码,我们将它们放入公司的 pom.xml
文件中。我们还考虑将密码存储在构建服务器上的 settings.xml
中。
当项目在开发人员计算机上构建并签名时,我们使用自签名证书对其进行签名。但是,当项目在构建服务器上构建并签名时,我们使用“官方”证书对其进行签名。
这是一个好的策略吗?
We have several maven projects, which are built on the build server. In some cases we want to sign our deliverables. We use Maven Jarsigner Plugin to do that.
We face the following questions:
- Where should we store the passwords for signing?
- What is a good strategy for signing maven projects?
We don't want to put our keystore somewhere on our servers and hardcode a path to it. So we just wrapped this keystore in a jar and uploaded it as an artifact to our inner maven repository. When we want to sign a maven project, we download the keystore artifact using the Maven Dependency Plugin and attach signing goal to maven build lifecycle. Here is more detailed information.
In order to hide the passwords for the keystore, we put them into our corporate pom.xml
file. We also think about storing passwords in settings.xml
on the build server.
When a project is built and signed on a developer machine, we sign it with self-signed certificate. But when project is built and signed on a build server, we sign it with our "official" certificate.
Is it a good strategy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用 2 个密钥库:
开发密钥库密码位于
pom.xml
中。这是我的pom.xml
的片段:在
~/.m2/settings.xml
中,我定义了一个codesgining
配置文件:当我想要时签署真实证书我使用
-Pcodesigning -Dkeystore.password=strongPassword
参数调用 maven。我还配置了 maven-release-plugin 以使用 <代码>代码设计配置文件。实际上,可以将密码存储在
settings.xml
中,只要该文件除了您之外没有人可读。I use 2 keystores:
The development keystore password is in the
pom.xml
. Here is a snippet of mypom.xml
:In
~/.m2/settings.xml
I defined acodesgining
profile:when I want to sign the real certificate I invoke maven with the
-Pcodesigning -Dkeystore.password=strongPassword
parameters. I also configured the maven-release-plugin to use thecodesigning
profile.Actually it is possible to store the password in
settings.xml
as long as the file is readable by nobody but you.