1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
------
Deploying to Repository
------
~~ 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.
Deploying to Repository
There are different ways on how you can deploy artifacts in an Archiva repository.
* {{{#Maven} Configuring Maven to deploy to an Archiva repository}}
* {{{#Web UI} Deploying via the Web UI Form}}
Starting with Archiva 1.2.3, it is possible to block re-deployment of released artifacts to a specific repository. This can be configured through the
repository configuration page by ticking the <<<Block Re-deployment of Released Artifacts>>> checkbox.
[]
<<WARNING>> The deployed artifact may not appear immediately in the search results.
The execution of the <<<index-content>>> repository consumer and other scanning consumers are queued for execution
to prevent concurrent updates to the index.
* Configuring {Maven} to deploy to an Archiva repository
[[1]] Create a user in Archiva to use for deployment (or use guest if you wish to deploy without a username and password)
[[2]] The deployment user needs the Role 'Repository Manager' for each repository that you want to deploy to
[[3]] Define the server for deployment inside your 'settings.xml', use the newly created user for authentication
+-------------------------------------------------------------------------+
<settings>
...
<servers>
<server>
<id>archiva.internal</id>
<username>{archiva-deployment-user}</username>
<password>{archiva-deployment-pwd}</password>
</server>
<server>
<id>archiva.snapshots</id>
<username>{archiva-deployment-user}</username>
<password>{archiva-deployment-pwd}</password>
</server>
...
</servers>
...
</settings>
+-------------------------------------------------------------------------+
** Deploying to Archiva using HTTP
Configure the <<<distributionManagement>>> part of your <<<pom.xml>>> (customising the URLs as needed).
The <<<id>>> of the repository in <<<distributionManagement>>> <<must>> match the <<<id>>> of the <<<server>>>
element in <<<settings.xml>>>.
+-------------------------------------------------------------------------+
<project>
...
<distributionManagement>
<repository>
<id>archiva.internal</id>
<name>Internal Release Repository</name>
<url>http://reposerver.mycompany.com:8080/archiva/repository/internal/</url>
</repository>
<snapshotRepository>
<id>archiva.snapshots</id>
<name>Internal Snapshot Repository</name>
<url>http://reposerver.mycompany.com:8080/archiva/repository/snapshots/</url>
</snapshotRepository>
</distributionManagement>
...
</project>
+-------------------------------------------------------------------------+
** Deploying to Archiva using WebDAV
In some cases, you may want to use WebDAV to deploy instead of HTTP. If you find this is necessary, follow the same
process as for HTTP, with these additional steps:
[[1]] Add <<<dav:>>> to the front of the deployment URLs:
+-------------------------------------------------------------------------+
<project>
...
<distributionManagement>
<repository>
<id>archiva.internal</id>
<name>Internal Release Repository</name>
<url>dav:http://reposerver.mycompany.com:8080/archiva/repository/internal/</url>
</repository>
<snapshotRepository>
<id>archiva.snapshots</id>
<name>Internal Snapshot Repository</name>
<url>dav:http://reposerver.mycompany.com:8080/archiva/repository/snapshots/</url>
</snapshotRepository>
</distributionManagement>
...
</project>
+-------------------------------------------------------------------------+
[[2]] Add a build extension to your <<<pom.xml>>> (not required in Maven 2.0.9 and above)
+-------------------------------------------------------------------------+
<project>
...
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-2</version>
</extension>
</extensions>
</build>
...
</project>
+-------------------------------------------------------------------------+
** Deploying using other protocols
You can also deploy to the Archiva server using traditional means such as SCP, FTP, etc. For more information on these deployment
techniques, refer to the Maven documentation.
Once the files are deployed into the location of the Archiva managed repository, they should appear in the Browse page.
The artifacts should also be searcheable as long as the <<<index-content>>> repository consumer is enabled.
** Deploying Third-Party Artifacts to Archiva using Maven
You can use <<<mvn deploy:deploy-file>>> to deploy single artifacts to Archiva. Once you have the settings file in place as
described above, you can deploy the artifact using this type of command:
+------+
mvn deploy:deploy-file -Dfile=filename.jar -DpomFile=filename.pom
-DrepositoryId=archiva.internal
-Durl=http://repo.mycompany.com:8080/repository/internal/
+------+
For more information, consult the {{{http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html} documentation for the
<<<deploy:deploy-file>>> goal}}
If you wish to use WebDAV to deploy the file, add <<<dav:>>> to the start of the URL as in the previous instructions.
However, on versions of Maven prior to 2.0.9, you will also need to create a file called <<<pom.xml>>>
in the directory from which you intend to execute "<<<mvn
deploy:deploy-file>>>":
+-------+
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>webdav-deploy</artifactId>
<packaging>pom</packaging>
<version>1</version>
<name>Webdav Deployment POM</name>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-2</version>
</extension>
</extensions>
</build>
</project>
+-------+
This pom will not be deployed with the artifact, it simply serves to make the
WebDAV protocol available to the build process.
Alternately, you can save this file somewhere else, and use "<<<mvn ... -f
/path/to/filename>>>" to force the use of an alternate POM file.
* Deploying via the {Web UI} Form
The easiest way to deploy in the repository is via the Web UI form, which can be accessed in the <<Upload Artifact>> section.
Just follow these steps:
[[1]] In Archiva, click the <<Upload Artifact>> option in the left menu. You should see a form similar to
the one at the end of this section.
[[2]] Fill in the following required fields:
* Group Id - the groupId of the artifact to be deployed.
* Artifact Id - the artifactId of the artifact to be deployed.
* Version - the version of the artifact to be deployed.
* Packaging - the packaging of the artifact to be deployed. (ex. jar, war, ear, etc.)
* Artifact File - the actual artifact to be deployed.
[]
[[3]] Select the repository you want to deploy to. Please note that if you do not have write permission to the repository,
you will not be allowed to deploy on it.
[[4]] Now, if you want Archiva to generate a pom for the artifact, check the Generate Maven 2 POM field.
(Right now, only Maven 2 poms can be generated.) Alternately, supply a POM file to be deployed alongside the artifact.
[[5]] Click Submit and a message will be displayed notifying you if the upload/deployment was successful or not.
[]
These are the files that will be in your repository after deployment:
* artifact
* POM file (if you supplied one or checked Generate Maven 2 POM)
* maven-metadata.xml (this will be created if none exists in the artifact level yet, otherwise it will just be updated)
* maven-metadata.xml.sha1 and maven-metadata.xml.md5 (these will be generated for newly created maven-metadata.xml files, otherwise
they will just be updated)
[]
[../images/upload-artifact.jpg] Upload Artifact
<Note:> The maximum size of the file that can be uploaded is 10M by default. To alter the setting, change <<<struts.multipart.maxSize>>> in the file
<<<WEB-INF/classes/struts.properties>>> in the Archiva web application (located under <<<apps/archiva>>> in the standalone distribution).
The upload form also provides validation checks against the required fields and the version. In Archiva 1.2.1, the version checking has been
loosened. See {{{http://jira.codehaus.org/browse/MRM-1172}MRM-1172}} for more details.
~~TODO: information for Maven 1, ant tasks, ivy, etc.
|