| ------ |
| Bootstrapping a Project Using a POM |
| ------ |
| Pete Marvin King |
| ------ |
| 2008-08-13 |
| ------ |
| |
| ~~ Licensed to the Apache Software Foundation (ASF) under one |
| ~~ or more contributor license agreements. See the NOTICE file |
| ~~ distributed with this work for additional information |
| ~~ regarding copyright ownership. The ASF licenses this file |
| ~~ to you under the Apache License, Version 2.0 (the |
| ~~ "License"); you may not use this file except in compliance |
| ~~ with the License. You may obtain a copy of the License at |
| ~~ |
| ~~ http://www.apache.org/licenses/LICENSE-2.0 |
| ~~ |
| ~~ Unless required by applicable law or agreed to in writing, |
| ~~ software distributed under the License is distributed on an |
| ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| ~~ KIND, either express or implied. See the License for the |
| ~~ specific language governing permissions and limitations |
| ~~ under the License. |
| |
| ~~ NOTE: For help with the syntax of this file, see: |
| ~~ http://maven.apache.org/doxia/references/apt-format.html |
| |
| 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 a 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>${project.version}</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 multimodule project, bootstrapping should be invoked as |
| |
| +---------+ |
| mvn scm:bootstrap -N |
| +---------+ |
| |
| By default the scm plugin will get the latest version from the trunk and generate it under <<<target/checkout>>> and execute |
| the configured goals in it. |
| |
| Configuring Authentication |
| |
| Most public repositories requires developers to authenticate first before they can pull the source from the repository. |
| For repositories requiring authentication, the scm plugin needs to be configured in one of the following ways: |
| |
| * In the <<<poml.xml>>> |
| |
| +-----------+ |
| <project> |
| ... |
| <build> |
| ... |
| <plugins> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-scm-plugin</artifactId> |
| <version>${project.version}</version> |
| <configuration> |
| <username>username</username> |
| <password>password</password> |
| </configuration> |
| </plugin> |
| </plugins> |
| ... |
| </build> |
| ... |
| </project> |
| +-----------+ |
| |
| * In the <<<settings.xml>>> via a <<<server>>> entry, using the host name from the connection URL as the server id |
| |
| +-----------+ |
| <settings> |
| ... |
| <servers> |
| <server> |
| <id>hostname</id> |
| <username>username</username> |
| <password>password</password> |
| </server> |
| </servers> |
| ... |
| </settings> |
| +-----------+ |
| |
| Since version 1.5, the plugin also recognizes {{{http://maven.apache.org/guides/mini/guide-encryption.html}encrypted passwords}}. |