我可以像这样将我的项目部署到远程服务器:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>myproject</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>3.0.0</version>
</extension>
</extensions>
</build>
<distributionManagement>
<repository>
<id>internal</id>
<url>scpexe://maven@myserver.com/home/maven</url>
</repository>
</distributionManagement>
</project>
maven
scp
我可以简单地使用
scp somefile.txt me@myserver.com:
文件被传输到
家
我的服务器上用户的目录。但是如果我在
pom.xml
<distributionManagement>
<repository>
<id>internal</id>
<url>scpexe://maven@myserver.com:</url>
</repository>
</distributionManagement>
我收到以下错误消息:
Execution default-deploy of goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy failed: For input string: "" -> [Help 1]
<distributionManagement>
<repository>
<id>internal</id>
<url>scpexe://maven@myserver.com</url>
</repository>
</distributionManagement>
然后Maven尝试创建repo结构并将工件直接部署到服务器根目录。所以我得到了这个错误消息:
Error executing command for transfer: Exit code 1 - mkdir: cannot create directory â
有没有一种方法可以将maven存储库指定为驻留在用户主目录中,而不必手动指定主目录的位置?