为maven密码加密生成settings-security.xml文件 [英] Generate settings-security.xml file for maven password encryption

查看:196
本文介绍了为maven密码加密生成settings-security.xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 maven 密码加密.

我做到了:

mvn --encrypt-master-password 12345

好的.我在括号内得到了一个加密密码.然后:

Fine. I got an encrypted password inside brackets. Then:

mvn --encrypt-password 12345

Maven 抱怨:

[ERROR] Error executing Maven.
[ERROR] java.io.FileNotFoundException: /home/myUserName/.m2/settings-security.xml (No such file or directory)
[ERROR] Caused by: /home/myUserName/.m2/settings-security.xml (No such file or directory)

我知道我应该将我的加密主密码放在文件 settings-security.xml 中,但它在默认位置不存在并且 maven 无法生成它.

I understand that I should put my encrypted master password in the file settings-security.xml, but it does not exist at the default location and maven is not able to generate it.

这个配置文件的内容应该是什么?如何生成它?

What should be the content of this configuration file? How to generate it?

推荐答案

mvn --encrypt-master-password 不创建文件 settings-security.xml.你必须自己做.

mvn --encrypt-master-password does not create a file settings-security.xml. You have to do it yourself.

所以程序是:

  1. 使用命令 mvn --encrypt-master-password 生成主密码.记住这个密码.
  2. ${user.home}/.m2/ 中创建一个新文件 settings-security.xml.例如,在 Mac OS X 或 Ubuntu 上为 ~/.m2/settings-security.xml.
  1. Use the command mvn --encrypt-master-password to generate a master password. Remember this password.
  2. Create a new file settings-security.xml in ${user.home}/.m2/. For example, on Mac OS X or Ubuntu as ~/.m2/settings-security.xml.

写入此文件:

<settingsSecurity>
  <master>OUTPUT OF THE COMMAND: mvn --encrypt-master-password</master>
</settingsSecurity>

例如:

<settingsSecurity>
  <master>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master>
</settingsSecurity>

之后 maven encrypt 命令在命令行上工作:

After that the maven encrypt command works on the command line:

mvn --encrypt-password

正如 khmarbaise 所提到的,更详细的信息可以在这里找到:https://maven.apache.org/guides/mini/guide-encryption.html

As mentioned by khmarbaise, more detailed information can be found here: https://maven.apache.org/guides/mini/guide-encryption.html

这篇关于为maven密码加密生成settings-security.xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆