Debian Codegraph @

src/site/apt/usage.apt

raw
1 ------
2 Usage
3 ------
4 Jerome Lacoste
5 John Casey
6 ------
7 2006-01-29
8 ------
9
10 ~~ Licensed to the Apache Software Foundation (ASF) under one
11 ~~ or more contributor license agreements. See the NOTICE file
12 ~~ distributed with this work for additional information
13 ~~ regarding copyright ownership. The ASF licenses this file
14 ~~ to you under the Apache License, Version 2.0 (the
15 ~~ "License"); you may not use this file except in compliance
16 ~~ with the License. You may obtain a copy of the License at
17 ~~
18 ~~ http://www.apache.org/licenses/LICENSE-2.0
19 ~~
20 ~~ Unless required by applicable law or agreed to in writing,
21 ~~ software distributed under the License is distributed on an
22 ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23 ~~ KIND, either express or implied. See the License for the
24 ~~ specific language governing permissions and limitations
25 ~~ under the License.
26
27 ~~ NOTE: For help with the syntax of this file, see:
28 ~~ http://maven.apache.org/doxia/references/apt-format.html
29
30 Usage
31
32 * Introduction
33
34 The Deploy Plugin has two basic functions. In most project builds, the
35 <<<deploy>>> phase of the build lifecycle is implemented using the
36 <<<deploy:deploy>>> mojo. Also, artifacts which are not built using Maven can
37 be added to any remote repository using the <<<deploy:deploy-file>>> mojo.
38
39 * The <<<deploy:deploy>>> Mojo
40
41 In most cases, this mojo is invoked when you call the <<<deploy>>> phase of
42 the default build lifecycle.
43
44 To enable this mojo to function, you must include a valid
45 <<<\<distributionManagement/\>>>> section POM, which at the minimum provides a
46 <<<\<repository/\>>>> defining the remote repository location for your
47 artifact. To separate snapshot artifacts from release artifacts, you can also
48 specify a <<<\<snapshotRepository/\>>>> location. Finally, to deploy a project
49 website, you must specify a <<<\<site/\>>>> section here as well. It's also
50 important to note that this section can be inherited, allowing you to specify
51 the deployment location one time for a set of related projects.
52
53 If your repository is secured, you may also want to configure your
54 <<<settings.xml>>> file to define corresponding <<<\<server/\>>>> entries
55 which provides authentication information. Server entries are matched to the
56 different parts of the distributionManagement using their <<<\<id/\>>>>
57 elements. For example, your project may have a distributionManagement section
58 similar to the following:
59
60 +---+
61 [...]
62 <distributionManagement>
63 <repository>
64 <id>internal.repo</id>
65 <name>MyCo Internal Repository</name>
66 <url>Host to Company Repository</url>
67 </repository>
68 </distributionManagement>
69 [...]
70 +---+
71
72 In this case, you can specify a server definition in your <<<settings.xml>>>
73 to provide authentication information for both of these repositories at once.
74 Your server section might look like this:
75
76 +---+
77 [...]
78 <server>
79 <id>internal.repo</id>
80 <username>maven</username>
81 <password>foobar</password>
82 </server>
83 [...]
84 +---+
85
86 Please see the article about
87 {{{https://maven.apache.org/guides/mini/guide-encryption.html}Password Encryption}}
88 for instructions on how to avoid clear text passwords in the <<<settings.xml>>>.
89
90 Once you've configured your repository deployment information correctly
91 deploying your project's artifact will only require invocation of the
92 <<<deploy>>> phase of the build:
93
94 +---+
95 mvn deploy
96 +---+
97
98
99 * The <<<deploy:deploy-file>>> Mojo
100
101 The <<<deploy:deploy-file>>> mojo is used primarily for deploying artifacts,
102 which were not built by Maven. The project's development team may or may not
103 provide a POM for the artifact, and in some cases you may want to deploy the
104 artifact to an internal remote repository. The deploy-file mojo provides
105 functionality covering all of these use cases, and offers a wide range of
106 configurability for generating a POM on-the-fly. Additionally, you can specify
107 what layout your repository uses. The full usage statement of the deploy-file
108 mojo can be described as:
109
110 +---+
111 mvn deploy:deploy-file -Durl=file://C:\m2-repo \
112 -DrepositoryId=some.id \
113 -Dfile=your-artifact-1.0.jar \
114 [-DpomFile=your-pom.xml] \
115 [-DgroupId=org.some.group] \
116 [-DartifactId=your-artifact] \
117 [-Dversion=1.0] \
118 [-Dpackaging=jar] \
119 [-Dclassifier=test] \
120 [-DgeneratePom=true] \
121 [-DgeneratePom.description="My Project Description"] \
122 [-DrepositoryLayout=legacy]
123 +---+
124
125 If the following required information is not specified in some way, the goal
126 will fail:
127
128 * the artifact file to deploy
129
130 * the group, artifact, version and packaging of the file to deploy. These can
131 be taken from the specified pomFile, and overriden or specified using the
132 command line. When the pomFile contains a <parent> section, the parent's
133 groupId can be considered if the groupId is not specified further for the
134 current project or on the command line.
135
136 * the repository information: the url to deploy to and the repositoryId
137 mapping to a server section in the settings.xml file. If you don't specify a
138 repositoryId, Maven will try to extract authentication information using the
139 id <<<'remote-repository'>>>.
140
141 []
142