If you are moving a project from Maven 1 to Maven 2, you can get some help from the Maven One plugin. It can convert your project's project.xml and project.properties into a pom.xml . To do this, change to the directory where your project.xml file is located and issue this command on the command line:
mvn one:convert
This goal uses maven-model-converter which not only converts your project model, it also has relocators for many plugins and converters for their configurations. So if you had some configuration properties for the Maven 1 jar-plugin, a converter will try to create a suitable configuration section for the Maven 2 jar-plugin inside your new pom.xml . You need to review the versions for the plugins in pom.xml after it has been created, as the versions might not be the same as for the Maven 1 plugins.
To package a Maven 1.x plugin using Maven 2.x, you need to include the Maven One plugin in the build section and use a packaging of maven-one-plugin . Like this:
<project> ... <packaging>maven-one-plugin</packaging> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-one-plugin</artifactId> <extensions>true</extensions> </plugin> ... </plugins> </build> ... </project>
To have your artifact installed into a local Maven 1.x repository, you add a lifecycle binding to your POM using <executions> :
<project> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-one-plugin</artifactId> <executions> <execution> <goals> <goal>install-maven-one-repository</goal> </goals> </execution> </executions> </plugin> ... </plugins> </build> ... </project>
Note: The plugin section can be shared with the one above in the case of building a Maven 1.x plugin.
This will read the local repository location from ~/build.properties , defaulting to ~/.maven/repository .
To have your artifact deployed into an additional remote Maven 1.x repository, you need to add a lifecycle binding to your POM. This configuration will deploy your artifact to the Maven 1.x repository at Apache:
<project> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-one-plugin</artifactId> <executions> <execution> <configuration> <remoteRepositoryUrl>scp://people.apache.org/repository</remoteRepositoryUrl> </configuration> <goals> <goal>deploy-maven-one-repository</goal> </goals> </execution> </executions> </plugin> ... </plugins> </build> ... </project>
This will not read any settings from the Maven 1.x properties, so the URL is required.
If you configure server settings in your settings.xml file, use the ID of mavenOneRemoteRepository . This can be overridden using the remoteRepositoryId configuration element.
For more information, see the Goal Reference .