I'm trying to build a jar using maven and automatically scp it to a remote machine.
This is my pom.xml
<properties>
<deploy.username>root</deploy.username>
<deploy.host>10.10.4.10</deploy.host>
<deploy.port>22</deploy.port>
<deploy.dir>/root</deploy.dir>
</properties>
<distributionManagement>
<repository>
<id>repo1</id>
<url>scpexe://${deploy.host}:${deploy.dir}</url>
</repository>
</distributionManagement>
This is my settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>repo1</id>
<username>root</username>
<password>root</password>
</server>
</servers>
</settings>
This the error log
Caused by: org.eclipse.aether.transfer.MetadataTransferException: Could not transfer metadata com.github.rssanders3.spark:spark_quick_start:1.0-SNAPSHOT/maven-metadata.xml from/to repo1 (scpexe://10.10.4.10:/root): Exit code: 1 - Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
at org.eclipse.aether.connector.basic.MetadataTransportListener.transferFailed(MetadataTransportListener.java:43)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:222)
at org.eclipse.aether.internal.impl.DefaultDeployer.upload(DefaultDeployer.java:417)
... 28 more
Caused by: org.apache.maven.wagon.TransferFailedException: Exit code: 1 - Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
You can see the full output of maven -X in here
I'm submitting using the following command:
mvn deploy -DskipTests --settings settings.xml
The user name and and password is correct, I'm able to ssh to it use this credential. I even tried to scp a file to the remote without any problem.
I check maven debug output, it is loading the user defined settings.xml I created.
[DEBUG] Reading user settings from /Users/xuanyue/tmp/apache-spark-quickstart-project/settings.xml
And on the ssh server side, this is the only thing I get:
Feb 23 14:33:02 hadoop10 sshd[23804]: Connection closed by 192.168.100.26
I also tried replace scpexe with scp. Still not worked.
Try running it with the -X option:
mvn -X deploy -DskipTests --settings settings.xml
I suspect the problem may be to do with the user at the other side and their permissions (not necessarily file system permissions).
First you could restart sshd on your server with -v (or -vvv for full debug) and thus get more logs in your security file.
Also it looks to me you are trying to scp on a server, have you tried using the plugin org.apache.maven.wagon ?
See Mr Thivent's post: Uploading a File via SCP with Maven fails
You probably need the Maven Wagon Provider for SSH. Note that it must be added as a build extension.
<project>
...
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.10</version>
</extension>
</extensions>
</build>
...
</project>
If you have this Wagon Provider, then the failure is likely due to your using an ancient version of Maven Wagon (you mentioned version 1.0-beta-6), which might work well with matching ancient versions (but certainly won't work well with the modern maven-dist-plugin).
Beta versions of Maven Wagon SSH do not need to be used. The current version as of now is 2.10.
Likewise, I don't believe you need to include the Maven Wagon Plugin as the maven-dist-plugin doesn't use that plugin, it directly uses the more modern wagon-provider-api. You should only need the SSH Wagon extension.
Finally, you should run a remote sshd instance for testing, from the command line (so the information goes to the terminal) with enough debugging on to determine if you are reaching the test box, and if you are actually passing in valid credentials (as sshd considers them).
It is important to remember that sshd has specific configuration options which deny root logins, if they are set. If you have access to the remote sshd box, you might also want to verify the sshd settings.
Related
I am new to Maven and trying to setup my first project in Maven but receiving the below error message when I am doing " Run as -> Maven install " in Eclipse. Below is my settings.xml and pom.xml
Settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:\Users\Iam\.m2\repository</localRepository>
<profiles>
<profile>
<repositories>
<repository>
<id>central</id>
<url>http://central.maven.org/maven2/</url>
</repository>
</repositories>
<pluginRepositories>
</pluginRepositories>
</profile>
</profiles>
</settings>
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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mytest</groupId>
<artifactId>MySpringBootMaven</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.11.RELEASE</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version><!--$NO-MVN-MAN-VER$-->
<configuration>
<warnName>Test.war</warnName>
</configuration>
</plugin>
</plugins>
</build>
</project>
Error message:
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.springframework.boot:spring-boot-maven-plugin:jar:1.5.11.RELEASE
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:302)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:218)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:287)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:103)
... 27 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:1.5.11.RELEASE from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:287)
... 30 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:1.5.11.RELEASE from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
How to resolve the Received fatal alert: protocol_version ? My java version is 1.7 and maven version is 3.3.3
Sonatype no longer supports TLSv1.1 and below (effective, June 18th, 2018). My guess is that you are using TLSv1.1 protocol or below.
The documentation I listed gives you 4 options:
Upgrade your Java runtime, for example with OpenJDK builds or Oracle paying support
Configure your Java runtime to enable TLS 1.2 by adding -Dhttps.protocols=TLSv1.2
Use a repository manager that uses a Java version supporting TLS 1.2
Revert back to http until you can acheive one of the above remediation steps.
I fixed it myself by just using -Dhttps.protocols=TLSv1.2 as a VM argument.
For a permanent solution(mostly required in Java 7) - in you build directory(where you do the mvn command from) add directory:
.mvn (in cmd mkdir .mvn)
and in it create file
jvm.config
and in put the following line:
-Dhttps.protocols=TLSv1.2
The simplest solution is to configure your JVM runtime arguments. On eclipse, you can do it as following :
go to windows>preferences>java>installed JREs
click on the Intalled JRE/JDK you are using for your project
click on "edit" on le right,
and add -Dhttps.protocols=TLSv1.2 in the Default VM arguments Input field.
see the screenshot :
The Package you are trying to install doesn't support TLS1.1 and you might be by default using TLS 1.1. Configure your Java runtime to enable TLS 1.2 by adding -Dhttps.protocols=TLSv1.2 to your Maven Build command would solve the problem.
For Example: mvn clean install -Dhttps.protocols=TLSv1.2
I had upgraded from Java 1.7 to Java 1.8 and got the same error.
To resolve this error, I checked the mvn version using mvn -version and found that JAVA_HOME was still using the Java 1.7. I changed the JAVA_HOME in the environment variable to point to Java 1.8 jre in JDK
Hope this helps someone.
I set my settings.xml file in the .m2 directory just as the one here: https://github.com/alipay/sofa-rpc/pull/190/files
Then exec mvn install and all dependencies started to download. I haven't had a settings.xml file before and I am not using any proxy.
Hope it helps somebody.
PD. I have jdk 1.7 and Maven 3.3.9
I resolved this error in SpringToolSuit by adding settings.xml file in .m2 folder which is located in Users folder of C drive and by updating Project by
right click on pom.xml -> Maeven -> Update Project.
Make sure you select Force update of snapshots/releases.
It needs both : Configuring the JVM runtime arguments as well as having a settings.xml, after I did both it worked. Updating only the JVM runtime argument did not help.
In my case the automatic update of maven dependencies were disabled in eclipse.
Solution:
Go to
Windows->Preferences->Maven
and uncheck the check box
"Do not automatically update dependencies from remote repositories"
Then update the project
Right click on project->maven->update project
I had the same issue, I tried most of the answers here but still did not work. My issue was Proxy settings on my IDE. So it is also important to remember to check proxy settings. File > Settings > System Settings > HTTP Proxy - Select Auto-Detect proxy settings
On my new laptop (Win10) I have downgraded maven 3.8.7->3.6.3 and jdk 19->1.8
Maven 3.8.7 is blocking a lot of old repositories, one sometimes does need.
I am trying to fully automate a build and, most importantly, a release using maven in travis-ci. The way I am attempting to do it it to supply the username and password commandline as properties and have them substituted in the settings.xml file. Then, when running the build, I override the location of settings.xml to be a file I checked in. Everything needed to build and release needs to be checked into the repo. It doesn't look like maven is doing the property substitution though.
Example:
settings.xml
<?xml version='1.0' encoding='UTF-8'?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>
build command:
mvn --settings $PWD/settings.xml -e -X -B release:prepare release:perform "-DSONATYPE_USERNAME=YYIaF/A4" "-DSONATYPE_PASSWORD=kowLPBgK+/kRiC+O96YZT1ibvxrdcKc" -Dgpg.passphrase=passphrase
These are not the actual credentials but I included the fact they have some funky characters incase that matters.
error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project foo-parent: Failed to deploy artifacts: Could not transfer artifact com.baz:foo-parent:pom:3.0.3 from/to sonatype-nexus-staging (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Failed to transfer file: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/baz/foo-parent/3.0.3/foo-3.0.3.pom. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
but if I do this the official way (.m2/settings.xml) - all is good.
Since the objective is to fully automate a release from travis-ci, if there is just a direct way to do that, I am all ears.
I am trying to run a mvn deploy goal with maven on my Liferay portlet but am getting the following error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.
2:deploy (default-deploy) on project MyPortlet: Deployment failed: repository eleme
nt was not specified in the POM inside distributionManagement element or in -Dal
tDeploymentRepository=id::layout::url parameter -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on pro
ject RiskID: Deployment failed: repository element was not specified in the POM
inside distributionManagement element or in -DaltDeploymentRepository=id::layout
I understand this error will return if you don't include the <distributionManagement /> tag in the pom.xml, however I don't wish to package this to a remote location and would like to instead deploy to my local tomcat instance; can this be configured?
The error is not about dependencyManagement but rather distributionManagement
Deployment failed: repository eleme
nt was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
The alternative (if you don't want to place it in your pom.xml file) is also provided by using the altDeploymentRepository option:
Specifies an alternative repository to which the project artifacts should be deployed ( other than those specified in <distributionManagement> ).
Format: id::layout::url
The first element, the id, must have a matching with a server defined in your settings.xml file (where you specify the credentials to use for the specific server).
The layour and the url are then specific to the target repository.
You can then invoke the command as:
mvn deploy -DaltDeploymentRepository=test:Maven2:http://somewhere:someport
Where test is the id of a server element in your Maven settings
<servers>
<server>
<id>test</id>
<username>my_login</username>
<password>my_password</password>
</server>
</servers>
Update
Based on latest clarifications (via comments and edits), here some important points:
The Maven deploy phase is meant for
done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.
Hence, in your case you don't need to use the deploy phase nor the maven-deploy-plugin.
Since Tomcat is the target server, you then need to use the tomcat7-maven-plugin
Here are few instructions:
Configure your pom.xml
Add to your pom.xml the following:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>tomcat8</server>
<path>/${project.build.finalName}</path>
</configuration>
</plugin>
Configure your settings.xml
Add to your Maven settings.xml the following in the servers section:
<server>
<username>maven</username>
<password>maven</password>
<id>tomcat8</id>
</server>
Note the matching tomcat8 id between the settings and the plugin configuration above, server element.
Configure Tomcat for deploy
In the tomcat conf folder, configure the tomcat-users.xml file:
<role rolename="manager-script"/>
<user username="maven" password="maven" roles="manager-gui,manager-script"/>
note the credentials matching with what we actually specified in the Maven settings.
Try it
Then from the command line you can finally invoke:
mvn tomcat7:deploy
If you don't want to configure settings.xml nor pom.xml, you then need to pass several parameters via command line as following:
mvn org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy \
-Durl=http://localhost:8080/manager/text \
-Dusername=maven -Dpassword=maven
Note: \ and newlines added for readibility
Check full list of options on the official documentation of its deploy goal.
#A_Di-Matteo's answer is correct for deploying to tomcat. But if you came here looking for how to deploy to a Maven repo without putting repo URLs in pom.xml then here's your answer:
mvn deploy -DskipTests -DaltDeploymentRepository=myrepoid::default::https://maven.example.org/repository/maven-releases
Instead of altDeploymentRepository, you could also use altReleaseDeploymentRepository or altSnapshotDeploymentRepository
More details in docs: https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html
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 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 :
<server>
<id>internal</id>
<username>*********</username>
<password>*********</password>
<configuration>
<StrictHostKeyChecking>ask</StrictHostKeyChecking>
</configuration>
</server>
I also tried putting StrictHostKeyChecking to "no", but, security risks aside, did not work on a particular machine.
Has someone found a way to use an internal ssh repository consistently on all machines?
There are three potential approaches to deploy Maven artifacts via SSH/SCP:
wagon-ssh (deprecated)
wagon-ssh-external (platform-specific concerns)
A wagon-ssh rewrite built on Apache Mina SSHD (does not actually exist yet as of this writing)
1. wagon-ssh
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.)
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>
Unfortunately, this wagon is now deprecated for two reasons: it is built on JSch which is not fully open source, and it is difficult to maintain due to complex and low level code needed. See WAGON-616 for details.
2. wagon-ssh-external
The Maven SSH External Wagon calls out to your system SSH/SCP commands. Unfortunately, there are some OS-specific configuration issues, particularly on Windows, as explained in the Deployment of artifacts in an external SSH command guide, and as highlighted in the question above.
3. wagon-ssh rewrite using Apache Mina SSHD
A viable hope for a pure-Java SSH/SCP wagon would be to rework the wagon-ssh implementation to use Apache Mina SSHD instead of JSch. Unfortunately, no one has actually done this yet, but the maintainer of wagon-ssh has indicated that it could be un-deprecated should anyone in the community step forward to tackle the project.
I am using SourceForge for some Open Source projects and I want to automate the deployment of releases to the SourceForge File Release System. I use Maven for my builds and the standard SFTP deployment mechanism doesn't seem to work unless you do some manual preparation work. I have come across some old postings on other forums suggesting that the only approach is to write a Wagon specifically for SourceForge.
Has anybody had any recent experience with this?
I'm not able to test this to confirm, but I believe it is possible without writing any plugins.
You can deploy to SourceForge using SCP, and the maven-deploy-plugin can be configured to use SCP so it should work. You can also deploy your site to SourceForge via SCP.
You would configure the SourceForge server in your settings.xml to use a "combined" username with a comma separator. With these credentials:
SourceForge username: foo
SourceForge user password: secret
SourceForge project name: bar
Path: /home/frs/project/P/PR/PROJECT_UNIX_NAME/
- Substitute your project UNIX name data for /P/PR/PROJECT_UNIX_NAME
The server element would look like this:
<server>
<id>sourceforge</id>
<username>foo,bar</username>
<password>secret</password>
</server>
And the distributionManagement section in your POM would look like this:
<!-- Enabling the use of FTP -->
<distributionManagement>
<repository>
<id>ssh-repository</id>
<url>
scpexe://frs.sourceforge.net:/home/frs/project/P/PR/PROJECT_UNIX_NAME</url>
</repository>
</distributionManagement>
Finally declare that ssh-external is to be used:
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-alpha-5</version>
</extension>
</extensions>
</build>
If this doesn't work, you may be able to use the recommended approach in the site reference above, i.e. create a shell on shell.sourceforge.net with your username and project group:
ssh -t <username>,<project name>#shell.sf.net create
Then use shell.sourceforge.net (instead of web.sourceforge.net) in your site URL in the diestributionManagement section:
<url>scp://shell.sourceforge.net/home/frs/project/P/PR/PROJECT_UNIX_NAME/</url>
I have uploaded an example to sourceforge.net at: http://sf-mvn-plugins.sourceforge.net/example-1jar-thinlet/
You can check out it via svn - so you can see how to use plugins for upload and download of and to sourceforge.net file system area and web site.
The main points to upload are to use sftp:
Add this similar code to your pom.xml
<distributionManagement>
<!-- use the following if you're not using a snapshot version. -->
<repository>
<id>sourceforge-sf-mvn-plugins</id>
<name>FRS Area</name>
<uniqueVersion>false</uniqueVersion>
<url>sftp://web.sourceforge.net/home/frs/project/s/sf/sf-mvn-plugins/m2-repo</url>
</repository>
<site>
<id>sourceforge-sf-mvn-plugins</id>
<name>Web Area</name>
<url>
sftp://web.sourceforge.net/home/groups/s/sf/sf-mvn-plugins/htdocs/${artifactId}
</url>
</site>
</distributionManagement>
Add similar code to settings.xml
<server>
<id>sourceforge-sf-mvn-plugins-svn</id>
<username>tmichel,sf-mvn-plugins</username>
<password>secret</password>
</server>
<server>
<id>sourceforge-sf-mvn-plugins</id>
<username>user,project</username>
<password>secret</password>
</server>
The main point for download is to use the wagon-http-sourceforge maven plugin - please see at: sf-mvn-plugins.sourceforge.net/wagon-http-sourceforge/FAQ.html
Please add the following code to your pom.xml
<repositories>
<repository>
<id>sourceforge-svn</id>
<name>SF Maven Plugin SVN Repository</name>
<url>http://sf-mvn-plugins.svn.sourceforge.net/svnroot/sf-mvn-plugins/_m2-repo/trunk</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>sourceforge-frs</id>
<name>SF Maven Plugin Repository</name>
<url>http://sourceforge.net/projects/sf-mvn-plugins/files/m2-repo</url>
</pluginRepository>
</pluginRepositories>
<build>
<extensions>
<extension>
<groupId>net.sf.maven.plugins</groupId>
<artifactId>wagon-http-sourceforge</artifactId>
<version>0.4</version>
</extension>
</extensions>
:
</build>
It looks like I am going to have to write this myself.
https://sourceforge.net/projects/wagon-sf/
After trying this a number of times, I finally got it to work -- with sftp not scp. This should work from a unix box (or Mac) -- I'm not sure about sftp clients for Windoze. I am using mvn version 2.2.0 and I don't think I have any special plugins installed. This deploys the various mvn packages to the Files section of my project page.
You'll need to change the following in your settings to get it to work:
user -- replace with your sourceforce username
secret -- replace with your password
ormlite -- replace with your project name
/o/or/ -- replace with the first char and first 2 chars of your project name
In my $HOME/.m2/settings.xml file I have the following for the SF server:
<server>
<id>sourceforge</id>
<password>secret</password>
<filePermissions>775</filePermissions>
<directoryPermissions>775</directoryPermissions>
</server>
I don't specify the username in the settings.xml file because it needs to be username,project and I want to deploy multiple packages to SF. Then, in my pom.xml file for the ormlite package I have the following:
<distributionManagement>
<repository>
<id>sourceforge</id>
<name>SourceForge</name>
<url>sftp://user,ormlite#frs.sourceforge.net:/home/frs/project/o/or/ormlite/releases
</url>
</repository>
<snapshotRepository>
<id>sourceforge</id>
<name>SourceForge</name>
<url>sftp://user,ormlite#frs.sourceforge.net:/home/frs/project/o/or/ormlite/snapshots
</url>
</snapshotRepository>
</distributionManagement>
Obviously the /releases and /snapshots directory suffixes can be changed depending on your file hierarchy.
Where timp = user and webmacro = project
scp url does not work:
scp://timp,webmacro#shell.sourceforge.net:/home/groups/w/we/webmacro/htdocs/maven2/
sftp url works:
sftp://timp,webmacro#web.sourceforge.net:/home/groups/w/we/webmacro/htdocs/maven2
or for project release artifacts:
sftp://timp,webmacro#web.sourceforge.net:/home/frs/project/w/we/webmacro/releases
scp will work to shell.sourceforge.net, but you have to create the shell before use with
ssh -t timp,webmacro#shell.sourceforge.net create
This really did not turn out to be that hard. First up I had the mvn site:deploy working following the instructions at this sourceforge site. Basically you start the sourceforge shell with
ssh -t user,project#shell.sourceforge.net create
That will create the shell at their end with a folder mounted to your project on a path such as (depending on your projects name):
/home/groups/c/ch/chex4j/
In that shell I on the sourceforge server I created a folder for my repo under the project apache folder "htdocs" with
mkdir /home/groups/c/ch/chex4j/htdocs/maven2
In my settings.xml I set the username and password to that shell server so that maven can login:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd/">
<servers>
<server>
<id>chex4j.sf.net</id>
<username>me,myproject</username>
<password>password</password>
<filePermissions>775</filePermissions>
<directoryPermissions>775</directoryPermissions>
</server>
</servers>
</settings>
In the pom.xml you just need your distibutionManagement section setup to name the server by ID that you set the password for in your settings file:
<distributionManagement>
<site>
<id>chex4j.sf.net</id>
<url>scp://shell.sourceforge.net/home/groups/c/ch/chex4j/htdocs/
</url>
</site>
<repository>
<id>chex4j.sf.net</id>
<name>SourceForge shell repo</name>
<url>scp://shell.sourceforge.net/home/groups/c/ch/chex4j/htdocs/maven2</url>
</repository>
</distributionManagement>
There the repository entry is the one for the mvn deploy command and the site entry is for the mvn site:deploy command. Then all I have to do is start the shell connection to bring up the server side then on my local side just run:
mvn deploy
which uploads the jar, pom and sources and the like onto my sourceforge projects website. If you try to hit the /maven2 folder on your project website sourceforge kindly tell you that directory listing is off by default and how to fix it. To do this on the server shell you create a .htaccess file in your htdocs/maven2 folder containing the following apache options
Options +Indexes
Then bingo, you have a maven repo which looks like:
http://chex4j.sourceforge.net/maven2/net/sf/chex4j/chex4j-core/1.0.0/
Your sf.net shell it shuts down after a number of hours to not hog resources; so you run the "ssh -t ... create" when you want to deploy the site or your build artifacts.
You can browse all my maven project code under sourceforge to see my working settings:
http://chex4j.svn.sourceforge.net/viewvc/chex4j/branches/1.0.x/chex4j-core/
SCP URL does work. But do not use ":" after server name. MVN tries to read the following test as integer (port number).
You do not need to establish tunnels as simbo1905 did.
The Maven SourceForge plug-in does not work with Maven 2. Also I believe this plug-in uses FTP which is no longer supported.
I found that CruiseControl can upload releases to SFEE and also works with Maven and Maven2