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>