| 1 |
------ |
| 2 |
Bootstrapping a Project Using a POM |
| 3 |
------ |
| 4 |
Pete Marvin King |
| 5 |
------ |
| 6 |
2008-08-13 |
| 7 |
------ |
| 8 |
|
| 9 |
~~ Licensed to the Apache Software Foundation (ASF) under one |
| 10 |
~~ or more contributor license agreements. See the NOTICE file |
| 11 |
~~ distributed with this work for additional information |
| 12 |
~~ regarding copyright ownership. The ASF licenses this file |
| 13 |
~~ to you under the Apache License, Version 2.0 (the |
| 14 |
~~ "License"); you may not use this file except in compliance |
| 15 |
~~ with the License. You may obtain a copy of the License at |
| 16 |
~~ |
| 17 |
~~ http://www.apache.org/licenses/LICENSE-2.0 |
| 18 |
~~ |
| 19 |
~~ Unless required by applicable law or agreed to in writing, |
| 20 |
~~ software distributed under the License is distributed on an |
| 21 |
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 22 |
~~ KIND, either express or implied. See the License for the |
| 23 |
~~ specific language governing permissions and limitations |
| 24 |
~~ under the License. |
| 25 |
|
| 26 |
~~ NOTE: For help with the syntax of this file, see: |
| 27 |
~~ http://maven.apache.org/doxia/references/apt-format.html |
| 28 |
|
| 29 |
Bootstrapping a Project Using a POM |
| 30 |
|
| 31 |
Using the <<<scm:bootstrap>>> a project can be build from a fresh copy of the source in the scm repository. |
| 32 |
This is a convenient way to distribute a project because the bootstrap pom can be given to a developer to generate |
| 33 |
the maven build environment for the project. |
| 34 |
|
| 35 |
The <<<pom.xml>>> should contain a scm configuration for the bootstrap to work. |
| 36 |
|
| 37 |
+-----------+ |
| 38 |
<project> |
| 39 |
... |
| 40 |
<packaging>jar</packaging> |
| 41 |
<version>1.0-SNAPSHOT</version> |
| 42 |
<name>SCM Sample Project</name> |
| 43 |
<url>http://somecompany.com</url> |
| 44 |
<scm> |
| 45 |
<connection>scm:svn:http://somerepository.com/svn_repo/trunk</connection> |
| 46 |
<developerConnection>scm:svn:https://somerepository.com/svn_repo/trunk</developerConnection> |
| 47 |
<url>http://somerepository.com/view.cvs</url> |
| 48 |
</scm> |
| 49 |
... |
| 50 |
<build> |
| 51 |
... |
| 52 |
<plugins> |
| 53 |
<plugin> |
| 54 |
<groupId>org.apache.maven.plugins</groupId> |
| 55 |
<artifactId>maven-scm-plugin</artifactId> |
| 56 |
<version>${project.version}</version> |
| 57 |
<configuration> |
| 58 |
<goals>install</goals> |
| 59 |
</configuration> |
| 60 |
</plugin> |
| 61 |
</plugins> |
| 62 |
... |
| 63 |
</build> |
| 64 |
... |
| 65 |
</project> |
| 66 |
+-----------+ |
| 67 |
|
| 68 |
Assuming the scm configuration has been configured in the <<<pom.xml>>>, bootstrapping can be invoked by |
| 69 |
|
| 70 |
+---------+ |
| 71 |
mvn scm:bootstrap |
| 72 |
+---------+ |
| 73 |
|
| 74 |
or in case of a multimodule project, bootstrapping should be invoked as |
| 75 |
|
| 76 |
+---------+ |
| 77 |
mvn scm:bootstrap -N |
| 78 |
+---------+ |
| 79 |
|
| 80 |
By default the scm plugin will get the latest version from the trunk and generate it under <<<target/checkout>>> and execute |
| 81 |
the configured goals in it. |
| 82 |
|
| 83 |
Configuring Authentication |
| 84 |
|
| 85 |
Most public repositories requires developers to authenticate first before they can pull the source from the repository. |
| 86 |
For repositories requiring authentication, the scm plugin needs to be configured in one of the following ways: |
| 87 |
|
| 88 |
* In the <<<poml.xml>>> |
| 89 |
|
| 90 |
+-----------+ |
| 91 |
<project> |
| 92 |
... |
| 93 |
<build> |
| 94 |
... |
| 95 |
<plugins> |
| 96 |
<plugin> |
| 97 |
<groupId>org.apache.maven.plugins</groupId> |
| 98 |
<artifactId>maven-scm-plugin</artifactId> |
| 99 |
<version>${project.version}</version> |
| 100 |
<configuration> |
| 101 |
<username>username</username> |
| 102 |
<password>password</password> |
| 103 |
</configuration> |
| 104 |
</plugin> |
| 105 |
</plugins> |
| 106 |
... |
| 107 |
</build> |
| 108 |
... |
| 109 |
</project> |
| 110 |
+-----------+ |
| 111 |
|
| 112 |
* In the <<<settings.xml>>> via a <<<server>>> entry, using the host name from the connection URL as the server id |
| 113 |
|
| 114 |
+-----------+ |
| 115 |
<settings> |
| 116 |
... |
| 117 |
<servers> |
| 118 |
<server> |
| 119 |
<id>hostname</id> |
| 120 |
<username>username</username> |
| 121 |
<password>password</password> |
| 122 |
</server> |
| 123 |
</servers> |
| 124 |
... |
| 125 |
</settings> |
| 126 |
+-----------+ |
| 127 |
|
| 128 |
Since version 1.5, the plugin also recognizes {{{http://maven.apache.org/guides/mini/guide-encryption.html}encrypted passwords}}. |