有没有办法让maven

有没有办法让maven

本文介绍了有没有办法让maven scp旅行车在linux / mac / windows平台上保持一致?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于关于scp / ssh和maven的文档非常差,我尝试了不同的方法,基本上分为两大类:使用scpexe wagon和scp wagon。通常它们在linux和mac上都没有问题,但是在Windows上我从来没有找到让它在所有机器上运行的方法。

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方法(安装完成腻子后)并添加到路径) - settings.xml配置:

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:

scp approach - settings.xml :

 <server>
      <id>internal</id>
      <username>*********</username>
      <password>*********</password>
      <configuration>
           <StrictHostKeyChecking>ask</StrictHostKeyChecking>
      </configuration>
 </server>

我还尝试将StrictHostKeyChecking设置为no,但是,除了安全风险之外,还没有工作特定的机器。

I also tried putting StrictHostKeyChecking to "no", but, security risks aside, did not work on a particular machine.

有人找到了在所有机器上一致使用内部ssh存储库的方法吗?

Has someone found a way to use an internal ssh repository consistently on all machines?

推荐答案

使用JSch,SSH的纯Java实现,无论操作系统如何都可以工作。 (当这个问题最初发布时,情况可能并非如此,但现在确实如此。)文档仍然有一个名为,但不再需要这种方法。

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.) The Deploy Plugin documentation still has a guide called Deployment of artifacts in an external SSH command, but this approach is not necessary anymore.

以下是我成功部署的示例配置将SCP从带有Maven 3.0.4的Windows 7系统转移到Linux机箱。

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

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
    http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>hello</groupId>
  <artifactId>hello</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>

  <name>Hello</name>

  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ssh</artifactId>
        <version>2.3</version>
      </extension>
    </extensions>
  </build>

  <distributionManagement>
    <repository>
      <id>my-ssh-repo</id>
      <url>scp://my.server.url/path/to/ssh-repo</url>
    </repository>
  </distributionManagement>

</project>

settings.xml

<settings>
  <servers>
    <server>
      <id>my-ssh-repo</id>
      <username>myUser</username>
      <password>myPass</password>
    </server>
  </servers>
</settings>

这篇关于有没有办法让maven scp旅行车在linux / mac / windows平台上保持一致?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 18:58