2010-09-02 68 views
3

我试图部署一个工件到可通过scp访问的远程存储库,并且存在重复密码提示问题。我的settings.xml包含此片段:Maven部署文件重复密码提示到scp存储库

<servers> 
    <server> 
     <id>example.com</id> 
     <username>myusername</username> 
     <password>mypassword</password> 
     <filePermissions>664</filePermissions> 
     <directoryPermissions>775</directoryPermissions> 
     <configuration> 
     </configuration> 
    </server> 
</servers> 

命令行交互看起来是这样的:

$ mvn deploy:deploy-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dpackaging=jar -Dversion=11.2.0.1.0 -DrepositoryId=example.com -Durl=scp://example.com/maven2/ 
[INFO] Scanning for projects... 
[INFO] Searching repository for plugin with prefix: 'deploy'. 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Default Project 
[INFO] task-segment: [deploy:deploy-file] (aggregator-style) 
[INFO] ------------------------------------------------------------------------ 
[INFO] [deploy:deploy-file {execution: default-cli}] 
Keyboard interactive required, supplied password is ignored 
Password: : mypassword 
Uploading: scp://example.com/maven2//com/oracle/ojdbc6/11.2.0.1.0/ojdbc6-11.2.0.1.0.jar 
2061K uploaded (ojdbc6-11.2.0.1.0.jar) 
[INFO] Retrieving previous metadata from example.com 
Keyboard interactive required, supplied password is ignored 
Password: : mypassword 
[INFO] repository metadata for: 'artifact com.oracle:ojdbc6' could not be found on repository: example.com, so will be created 
[INFO] Uploading repository metadata for: 'artifact com.oracle:ojdbc6' 
Keyboard interactive required, supplied password is ignored 
Password: : mypassword 
[INFO] Uploading project information for ojdbc6 11.2.0.1.0 
Keyboard interactive required, supplied password is ignored 
Password: : mypassword 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESSFUL 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 30 seconds 
[INFO] Finished at: Thu Sep 02 13:03:33 CEST 2010 
[INFO] Final Memory: 5M/90M 
[INFO] ------------------------------------------------------------------------ 

有几个问题在这里:

  1. 提示我输入密码,即使虽然它在settings.xml中指定
  2. 密码在控制台上回显
  3. 它不记得密码,而是问我4次。

我该如何配置maven,以便它可以使用来自settings.xml的密码,或者向我询问一次而不回显我的密码到屏幕?

编辑:这是在Ubuntu Linux上,一个同事刚刚在Windows XP上重现了同样的问题。由于将存储库安装到本地路径不是Windows上的选项,因此我仍在寻找解决方案。

+0

得爱那些oracle版本号ojdbc6-11.2.0.1.0.jar。 .....我真的很期待Java版本7.0.0.1.0 – crowne 2010-11-03 14:02:18

+0

5年后,我有同样的错误:任何解决方案? – jeromerg 2016-08-24 19:56:42

回答

0

我们已经安装Nexus作为存储库管理器,并使用Web界面上传第三方jar。

0

您是否在您的pom中设置了repositoryId以使用settings.xml中正确的服务器条目,导致它看起来没有设置,因此它使用id:remote-repository。或者你是否相应地更改了settings.xml。

+0

我没有pom,因为这是我下载的外部工件。 repositoryId通过'-DrepositoryId = example.com'在命令行中指定。服务器设置似乎被maven使用,因为它不会要求我输入我的用户名,只能在settings.xml中设置。 – 2010-09-02 11:50:03

0

作为一种变通方法,我目前使用安装在sshfs的远程仓库,然后在Maven命令使用文件网址:

$ sudo adduser jh fuse 
$ sudo mkdir -p /mnt/example.com/maven2 
$ sudo chown -R jh:jh /mnt/example.com 
$ sshfs [email protected]:/maven2 /mnt/example.com/maven2 
$ mvn deploy:deploy-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dpackaging=jar -Dversion=11.2.0.1.0 -Durl=file:///mnt/example.com/maven2/repository/ 

配置的settings.xml中的服务器,则无需在此情况下, repositoryId不需要在命令行中指定,我可以在文件url上使用shell自动完成功能。

如果有人能够重现问题或使用maven标准提出解决方案,我仍然会对此感兴趣。

0

我没有一个确切的解决方案,但至少以下工作:

创建文件〜/ .m2目录/ settings.xml中的服务器条目:

<server> 
    <id>example-dist</id> 
    <username>myusername</username> 
    <password>ignored</password> 
</server> 

进行部署或部署:部署文件如下:

mvn deploy -DrepositoryId=example-dist 

系统会要求您输入用户名的密码 - settings.xml中的密码将被忽略。

如果您不想每次都提供密码,您可以通过使用ssh-keygen生成一个ssh密钥来实现。生成的公钥必须存储在分发服务器的authorized_keys文件中(有关更好的解释,请参阅Web或手册页上的多个教程)。

3

我找到了Maven的用户列表如下:

使用PasswordAuthentication no在服务器上的sshd。 切换到yes后,我的配置文件工作正常。

+0

它为我工作。然后,我使用'sudo /etc/init.d/sshd restart'来应用效果。 – dellasavia 2014-06-23 13:50:45

0

这个错误似乎相关。 http://jira.codehaus.org/browse/WAGON-323 即时消息:即使使用wagon-ssh-2.4,我也会收到消息“键盘交互需要,提供的密码被忽略”。 试图设置<interactiveMode>false</interactiveMode>,但随后auth失败。

相关问题