有没有办法让maven scp wagon在linux/mac/windows平台上一致工作?
鉴于关于 scp/ssh 和 maven 的文档非常差,我尝试了不同的方法,基本上分为两个主要类别:使用 scpexe wagon 和 scp wagon。通常它们在 Linux 和 Mac 上都可以正常工作,但在 Windows 上我从未找到一种方法让它在所有机器上工作。
scpexe 方法(安装完整的腻子并添加到路径后)-settings.xml 配置:
<server>
<id>internal</id>
<username>******</username>
<password>*******</password>
<configuration>
<sshExecutable>plink</sshExecutable>
<scpExecutable>pscp</scpExecutable>
</configuration>
</server>
scp 方法-settings.xml :
<server>
<id>internal</id>
<username>*********</username>
<password>*********</password>
<configuration>
<StrictHostKeyChecking>ask</StrictHostKeyChecking>
</configuration>
</server>
我还尝试将 StrictHostKeyChecking 设置为“否”,但是,除了安全风险之外,在特定计算机上不起作用。
有人找到了在所有机器上一致使用内部 ssh 存储库的方法吗?
Given the very poor documentation about scp/ssh and maven I tried different approaches, basically falling in two main categories: using scpexe wagon and scp wagon. Usually they both work without issue on both linux and mac, but on windows I never found a way to make it work on all machines.
scpexe approach (after installing complete putty and adding to path) - settings.xml configuration:
<server>
<id>internal</id>
<username>******</username>
<password>*******</password>
<configuration>
<sshExecutable>plink</sshExecutable>
<scpExecutable>pscp</scpExecutable>
</configuration>
</server>
scp approach - settings.xml :
<server>
<id>internal</id>
<username>*********</username>
<password>*********</password>
<configuration>
<StrictHostKeyChecking>ask</StrictHostKeyChecking>
</configuration>
</server>
I also tried putting StrictHostKeyChecking to "no", but, security risks aside, did not work on a particular machine.
Has someone found a way to use an internal ssh repository consistently on all machines?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过 SSH/SCP 部署 Maven 工件有三种可能的方法:
wagon-ssh
(已弃用)wagon-ssh-external
(特定于平台的问题)wagon -ssh
重写构建在 Apache Mina SSHD 上(实际上并不存在截至本文撰写时)1. wagon-ssh
Maven SSH wagon 使用 JSch,SSH 的纯 Java 实现,无论操作系统如何,它都可以工作。 (也许最初发布这个问题时情况并非如此,但现在确实如此。)
这是一个示例配置,我成功地使用它通过 SCP 从 Windows 7 系统和 Maven 3.0.4 部署到 Linux 机器。
pom.xml
:settings.xml
:不幸的是,这个 wagon 现在已被弃用,原因有两个:它是基于 JSch 构建的,JSch 不是完全开源的,而且很难由于需要复杂且低级的代码而需要维护。有关详细信息,请参阅 WAGON-616。
2. wagon-ssh-external
Maven SSH 外部 Wagon 调用您的系统 SSH/SCP 命令。不幸的是,存在一些特定于操作系统的配置问题,特别是在 Windows 上,如 在外部 SSH 命令中部署工件 指南,如上面问题中突出显示的那样。
3. 使用 Apache Mina SSHD 重写 wagon-ssh
纯 Java SSH/SCP wagon 的一个可行希望是重写
wagon-ssh
实现以使用 Apache Mina SSHD 而不是 JSch。不幸的是,目前还没有人真正做到这一点,但 wagon-ssh 的维护者表示,如果社区中的任何人挺身而出解决该项目,它可能会被取消弃用。There are three potential approaches to deploy Maven artifacts via SSH/SCP:
wagon-ssh
(deprecated)wagon-ssh-external
(platform-specific concerns)wagon-ssh
rewrite built on Apache Mina SSHD (does not actually exist yet as of this writing)1. wagon-ssh
The Maven SSH wagon uses JSch, the pure-Java implementation of SSH, which works regardless of OS. (Perhaps that was not the case when this question was originally posted, but it is true now.)
Here is a sample configuration which I successfully used to deploy over SCP to a Linux box from a Windows 7 system with Maven 3.0.4.
pom.xml
:settings.xml
:Unfortunately, this wagon is now deprecated for two reasons: it is built on JSch which is not fully open source, and it is difficult to maintain due to complex and low level code needed. See WAGON-616 for details.
2. wagon-ssh-external
The Maven SSH External Wagon calls out to your system SSH/SCP commands. Unfortunately, there are some OS-specific configuration issues, particularly on Windows, as explained in the Deployment of artifacts in an external SSH command guide, and as highlighted in the question above.
3. wagon-ssh rewrite using Apache Mina SSHD
A viable hope for a pure-Java SSH/SCP wagon would be to rework the
wagon-ssh
implementation to use Apache Mina SSHD instead of JSch. Unfortunately, no one has actually done this yet, but the maintainer ofwagon-ssh
has indicated that it could be un-deprecated should anyone in the community step forward to tackle the project.