How deploy maven3 artifact to remote server using scp
Hello everyone
I want to have my own maven repository for artifacts created by myself but
I have a problem trying to make a deploy of maven 3 artifact to a custom
server. To explain this better I'm going to give some information:
I'm using Maven 3
I'm using Eclipse Keppler
I'm using Jenkins
The remote server is running Ubuntu Server 11.04
Jenkins is running on the Ubuntu server
My local machine is running Windows XP
My first attempt was with my machine. I run Maven in Eclipse to make the
deploy, and everything works fine. I add the following to my projects pom
<build>
...
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-beta-6</version>
</extension>
</extensions>
...
</build>
...
<distributionManagement>
<repository>
<id>my server id</id>
<name>my repository name</name>
<url>scpexe://my server//path/to/my/repository</url>
</repository>
</distributionManagement>
And in my settings.xml I add
<servers>
<server>
<id>my server id</id>
<username>server username</username>
<password>server password</password>
<configuration>
<sshExecutable>plink</sshExecutable>
<scpExecutable>pscp</scpExecutable>
</configuration>
</server>
</servers>
So in my local machine it works, but I need to get this work using
Jenkins. I modified the Jenkins settings.xml, because it runs on Linux, so
doesn't need sshExecutable. The Jenkins settings.xml looks like
<servers>
<server>
<id>my server id</id>
<username>server username</username>
<password>server password</password>
</server>
</servers>
Then I modified the pom.xml to execute just scp and not scpexe
<distributionManagement>
<repository>
<id>my server id</id>
<name>my repository name</name>
<url>scp://my server//path/to/my/repository</url>
</repository>
</distributionManagement>
But according to this page
https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Compatibility+Notes
maven 3 does not support scp. I run it any way and I got the following
error message from Jenkins log
mavenExecutionResult exceptions not empty
message : Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy)
on project myproject: Failed to deploy artifacts/metadata: No connector
available to access repository my_repository (scp://my
server//path/to/my/repository) of type default using the available
factories WagonRepositoryConnectorFactory
cause : Failed to deploy artifacts/metadata: No connector available to
access repository my_repository (scp://my server//path/to/my/repository)
of type default using the available factories
WagonRepositoryConnectorFactory
Stack trace :
If I use scpexe instead of scp I got another error message
mavenExecutionResult exceptions not empty
message : Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy)
on project pruebanueva: Failed to deploy artifacts: Could not transfer
artifact {$groupId}:{$artifactId}:{$package}:{$version} from/to
my_repository (scpexe://my server//path/to/my/repository): Error executing
command for transfer
cause : Failed to deploy artifacts: Could not transfer artifact
{$groupId}:{$artifactId}:{$package}:{$version} from/to my_repository
(scpexe://my server//path/to/my/repository): Error executing command for
transfer
Stack trace :
The only way I could make deploy, was doing it in two steps
Configuring Jenkins to make just the install goal
Running the following command from command line
mvn deploy:deploy-file -DgroupId=$groupId -DartifactId=$artifactId
-Dversion=$version -Dpackaging=jar -Dfile=path/to/file.jar -Durl=scp://my
server//path/to/my/repository -DrepositoryId=my repository id
I tried many things, including writing that command into Jenkins goal, but
everytime I use the scp command in Jenkins the build fails.
Any idea of how to solve this issue will be appreciated, thanks in advance
No comments:
Post a Comment