是否可以在命令行的Maven Deploy中传递密码? [英] Is it possible to pass a password in Maven Deploy in the command line?

查看:1950
本文介绍了是否可以在命令行的Maven Deploy中传递密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是当前的工作方式,它是 Maven部署插件的用法

This is the way it currently works, and it's the Maven Deploy Plugin Usage

pom.xml

[...]
  <distributionManagement>
    <repository>
      <id>internal.repo</id>
      <name>MyCo Internal Repository</name>
      <url>Host to Company Repository</url>
    </repository>
  </distributionManagement>
[...]

settings.xml

settings.xml

[...]
    <server>
      <id>internal.repo</id>
      <username>someUser</username>
      <password>somePassword</password>
    </server>
[...]

我想实现的目标是找到一种在命令行中键入用户名和密码的方法.实现mvn deploy -someUser -somePassword

and what I'm trying to achieve is finding a way in which the username and password are typed in at the command line. to achieve mvn deploy -someUser -somePassword

推荐答案

settings.xml被认为是个人的,因此,用户名+密码存储在(user-)settings.xml中.因此,一般而言,没有理由将它们作为参数传递. (顺便说一句,密码可以在此处加密存储)maven-deploy-plugin没有选择通过命令行传递密码.但是,我见过类似的骇客:

The settings.xml is considered personal, so for that reason the username+password are stored in the (user-)settings.xml. So in general there's no reason to pass them as argument. (btw, passwords can be stored encrypted here) The maven-deploy-plugin has no option to pass them via commandline. However, I've seen hacks like:

<username>${internal.repo.username}</username>

现在您可以执行-Dinternal.repo.username=someUser

这篇关于是否可以在命令行的Maven Deploy中传递密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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