Configuring the Maven Site Plugin to accept scp-URLs for site:deploy
April 20, 2011
I ran into a slightly puzzling problem while upgrading from Maven2 to Maven3 this week. In hindsight the solution wasn’t all that complicated but it threw me a little because Maven is usually quite good at pulling all its required dependencies.
Basically, I was having trouble uploading files generated by Maven’s site plugin to a host. The URL was specified as follows
<site>scp://server:/some/long/path</site>
In Maven2 this worked out of the box without extra configuration.
In Maven3 this threw the following error during site-deploy:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:2.2:deploy (default-cli) on project $PROJECT_NAME: Unsupported protocol: 'scp': Cannot find wagon which supports the requested protocol: scp: java.util.NoSuchElementException
The trouble was that the Site Plugin apparently doesn’t automatically pull the Apache Wagon SSH implementation. You have to tell it manually to do that like this:
<build> ... <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>2.2</version> <dependencies> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-ssh</artifactId> <version>1.0-beta-7</version> </dependency> </dependencies> </plugin> </plugins> ... </build>
I am working on this now and I get one more error:
Failed to execute goal org.apache.maven.plugins:maven-site-plugin:2.2:deploy (default-cli) on project project: Error uploading site: Cannot connect. Reason: Algorithm negotiation fail -> [Help 1]
Your note here helped get me this far. Thanks for your post.
Once I get this working, I will be farther along in getting my web site working.
Can you connect to the server using plain SSH?
What does SSH say, when you use -v as a command line argument?
Also, see http://www.thegeekstuff.com/2008/07/howto-resolve-algorithm-negotiation-failed-issue-on-ssh/
Thanks. Grumpy that with Maven3 we have to configure the deploy and site deploy goals.
“In hindsight the solution wasn’t all that complicated but it threw me a little because Maven is usually quite good at pulling all its required dependencies.”
True, but this is a documented decision: https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html
”
Unlike Maven 2, Maven 3 supports out of the box only http:, https: and file: as transport protocols. To use other transport protocols like scp:, the appropriate wagons have to be explicitly declared in the POM as a build extension. If the wagon in question is only used for deployment to a repository, it can alternatively be declared as a dependency of the Maven Deploy Plugin.
“