Bootstrapping a Project Using a POM
Using the scm:bootstrap
a project can be build from a fresh copy of the source in the scm repository. This is a convenient way to distribute a project because the bootstrap POM can be given to a developer to generate the Maven build environment for the project.
The pom.xml
should contain an SCM configuration for the bootstrap to work.
<project>
...
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>SCM Sample Project</name>
<url>http://somecompany.com</url>
<scm>
<connection>scm:svn:http://somerepository.com/svn_repo/trunk</connection>
<developerConnection>scm:svn:https://somerepository.com/svn_repo/trunk</developerConnection>
<url>http://somerepository.com/view.cgi</url>
</scm>
...
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>2.2.0</version>
<configuration>
<goals>install</goals>
</configuration>
</plugin>
</plugins>
...
</build>
...
</project>
Assuming the SCM configuration has been configured in the pom.xml
, bootstrapping can be invoked by
mvn scm:bootstrap
or in case of a multi-module project, bootstrapping should be invoked as
mvn scm:bootstrap -N
By default the SCM plugin will get the latest version from the repository in its default branch and generate it under target/checkout
and execute the configured goals in it.
Configuring Authentication
Most public repositories require developers to authenticate first before they can pull the source from the repository. For repositories requiring authentication, the SCM plugin needs to be configured accordingly.