views:

1012

answers:

1

Maven has a plugin called maven-scm-plugin, which can interact with source control systems. According to the documentation, I should be able to export a project like this:

mvn scm:export -DconnectionUrl=scm:svn:svn://url... -DexportDirectory=./project-export

However when I run this command with maven 2.0.9, I got the following error from maven:

[INFO] Required goal not found: scm:export in org.apache.maven.plugins:maven-scm-plugin:1.0-beta-3

So it seems the beta-3 version of the plugin doesn't have the "export" goal, but it was added in 1.1. I do have both versions in my maven repo (.m2\repository\org\apache\maven\plugins\maven-scm-plugin), however maven insists on using the old beta version, and errors out when it can't find the "export" goal. How can I force maven to use the 1.1 version of the scm plugin? The mvn scm:export command is used independently, so there is no POM file to configure. Thanks!

A: 

Found the solution myself.. In the plugin directory (.m2\repository\org\apache\maven\plugins\maven-scm-plugin), there is a file called maven-metadata-central.xml. I used to have "1.0-beta-3" as the value for both the "latest" and "release" elements, and that's why maven insists on using this old version. After I changed them to 1.1, I was able to run the command.

SamS
Strictly speaking, this isn't the right approach. I know it works, but by doing this, you're changing the metadata associated with your repository. A better way is to specify the exact version of the plugin: __mvn org.apache.maven.plugins:maven-scm-plugin:1.1:export etc__
Ken Liu