2

我在 POM 中有一个部分,看起来像这样:

<scm>
    <connection>scm:cvs:ext:myhostname:/cvsroot/repo:module_name</connection>
</scm>

我通常使用 publickey auth 对这个 cvs 服务器进行身份验证,尽管它也应该接受我的密码。

当我尝试运行mvn scm:updatemvn release:prepare或任何其他涉及连接到此 scm 的 Maven 目标时,我收到以下失败:

[INFO] Executing: cmd.exe /X /C "cvs -z3 -f -q update -d"
[INFO] Working directory: C:\Documents and Settings\matt\workspace\projectname
org.netbeans.lib.cvsclient.connection.AuthenticationException: Cannot authenticate. Reason: Publickey authentication failed.
    at org.apache.maven.scm.provider.cvslib.cvsjava.util.ExtConnection.open(ExtConnection.java:136)
    at org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsConnection.connect(CvsConnection.java:166)
    at org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsConnection.processCommand(CvsConnection.java:498)
    at org.apache.maven.scm.provider.cvslib.cvsjava.command.update.CvsJavaUpdateCommand.executeCvsCommand(CvsJavaUpdateCommand.java:53)
    at org.apache.maven.scm.provider.cvslib.command.update.AbstractCvsUpdateCommand.executeUpdateCommand(AbstractCvsUpdateCommand.java:78)
    at org.apache.maven.scm.command.update.AbstractUpdateCommand.executeCommand(AbstractUpdateCommand.java:63)
    at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
    at org.apache.maven.scm.provider.cvslib.AbstractCvsScmProvider.executeCommand(AbstractCvsScmProvider.java:750)
    at org.apache.maven.scm.provider.cvslib.AbstractCvsScmProvider.update(AbstractCvsScmProvider.java:348)
    at org.apache.maven.scm.provider.AbstractScmProvider.update(AbstractScmProvider.java:821)
    at org.apache.maven.scm.provider.AbstractScmProvider.update(AbstractScmProvider.java:770)
    at org.apache.maven.scm.manager.AbstractScmManager.update(AbstractScmManager.java:526)
    at org.apache.maven.scm.plugin.UpdateMojo.execute(UpdateMojo.java:89)

(更多的堆栈跟踪......)

在堆栈跟踪中进一步向下:

Caused by: java.io.IOException: Decrypted PEM has wrong padding, did you specify the correct password?
    at ch.ethz.ssh2.crypto.PEMDecoder.removePadding(PEMDecoder.java:109)
    at ch.ethz.ssh2.crypto.PEMDecoder.decryptPEM(PEMDecoder.java:286)
    at ch.ethz.ssh2.crypto.PEMDecoder.decode(PEMDecoder.java:319)

其次是:

[ERROR] Provider message:
[ERROR] The cvs command failed.
[ERROR] Command output:

我在 Windows 机器上运行它,在PATH. 我在 下确实有我的公钥$HOME/.ssh,但似乎 cvs/maven/scm 没有在这里加载它——因为我没有被要求提供它的关键字。

所以我的问题是......我需要对 Maven 或 SCM/CVS 提供者做些什么特别的事情来让它识别我的公钥的安装位置,或者如何实际使用它?目前它似乎没有被使用,因为我没有被提示输入它的密码。

4

2 回答 2

4

So after debugging this a bit more, and downloading the source code for the maven-scm-provider-cvs package, I discovered that the CVS library used by this plugin uses the empty string ("") for the passphrase value if it finds your private key. To use the correct passphrase, the library expects you to set a System property with the key name maven.scm.cvs.java.ssh.passphrase.

So, if I run my scm:status goal like so:

mvn scm:status -Dmaven.scm.cvs.java.ssh.passphrase=<my passphrase>

I'm able to connect to CVS.

Gee - I really wish this was documented!

于 2009-06-15T18:13:39.857 回答
0

我通过在使用 maven 之前从控制台执行 cvs+ssh login 命令解决了这个问题。这将魔术数字添加到 $home/.ssh 以使自动登录起作用。

如果这是因为自签名证书,请查看InstallCert代码,了解如何将自签名证书添加到客户端。或者这个关于如何替换默认 X509 信任代码的示例。

于 2009-06-11T20:14:17.953 回答