I'm able to deploy my project to my remote server like this:
<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>
But (as you can see) I'm forced to specify the home directory of the maven
user on my server. Usually when I use scp
I can simply use scp somefile.txt me@myserver.com:
and the file is transferred to the home directory of the user on my server. But if I try something similar in the pom.xml
:
<distributionManagement>
<repository>
<id>internal</id>
<url>scpexe://maven@myserver.com:</url>
</repository>
</distributionManagement>
I get this error message:
Execution default-deploy of goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy failed: For input string: "" -> [Help 1]
If I try this:
<distributionManagement>
<repository>
<id>internal</id>
<url>scpexe://maven@myserver.com</url>
</repository>
</distributionManagement>
then Maven tries creating the repo structure and deploying the artifact directly to the server root directory. So I get this error message:
Error executing command for transfer: Exit code 1 - mkdir: cannot create directory ‘//com’: Permission denied -> [Help 1]
Is there a way to specify the maven repository as residing in the users home directory without having to manually specify where the home directory is?
The Maven configuration file uses a different syntax. What your example shows is this
<url>scpexe://maven@myserver.com/home/maven</url>
So by extension what you want is this
<url>scpexe://maven@myserver.com/</url>