使用Maven通过SSH分发构建文件

时间:2020-05-03 00:49:25

标签: maven ssh scp

我想使用maven的部署生命周期自动上传构建文件。但是,maven似乎无法上传文件。我正在使用Ubuntu 19.04,并且已经设置了paswordless ssh auth wia键。我知道那是行得通的,因为我多次使用它。

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:version:deploy (default-deploy) on project example: Failed to deploy artifacts: Could not transfer artifact com.example:jar:RELEASE from/to ssh-repository (scpexe://example.com/root): Error executing command for transfer

pom.xml

<distributionManagement>
    <repository>
        <id>ssh-repository</id>
        <url>scpexe://example.com/root</url>
    </repository>
</distributionManagement>

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

settings.xml

<settings>
    <servers>
        <server>
            <id>ssh-repository</id>
            <username>root</username>
            <privateKey>~/.ssh/id_rsa</privateKey> <!-- not needed if using pageant -->
            <configuration>
                <sshExecutable>ssh</sshExecutable>
                <scpExecutable>scp</scpExecutable>
            </configuration>
        </server>
    </servers>
</settings>

0 个答案:

没有答案