------ Deploying to Repository ------ 2012-09-15 ------ ~~ 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/guides/mini/guide-apt-format.html 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 <<>> checkbox. [] <> The deployed artifact may not appear immediately in the search results. The execution of the <<>> 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 +-------------------------------------------------------------------------+ archiva.internal {archiva-deployment-user} {archiva-deployment-pwd} archiva.snapshots {archiva-deployment-user} {archiva-deployment-pwd} +-------------------------------------------------------------------------+ ** Deploying to Archiva using HTTP Configure the <<>> part of your <<>> (customising the URLs as needed). The <<>> of the repository in <<>> <> match the <<>> of the <<>> element in <<>>. +-------------------------------------------------------------------------+ archiva.internal Internal Release Repository http://reposerver.mycompany.com:8080/repository/internal/ archiva.snapshots Internal Snapshot Repository http://reposerver.mycompany.com:8080/repository/snapshots/ +-------------------------------------------------------------------------+ ** 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 <<>> to the front of the deployment URLs: +-------------------------------------------------------------------------+ archiva.internal Internal Release Repository dav:http://reposerver.mycompany.com:8080/repository/internal/ archiva.snapshots Internal Snapshot Repository dav:http://reposerver.mycompany.com:8080/repository/snapshots/ +-------------------------------------------------------------------------+ [[2]] Add a build extension to your <<>> (not required in Maven 2.0.9 and above) +-------------------------------------------------------------------------+ org.apache.maven.wagon wagon-webdav-jackrabbit 2.2 +-------------------------------------------------------------------------+ ** 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 <<>> repository consumer is enabled. ** Deploying Third-Party Artifacts to Archiva using Maven You can use <<>> 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 <<>> goal}} If you wish to use WebDAV to deploy the file, add <<>> 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 <<>> in the directory from which you intend to execute "<<>>": +-------+ 4.0.0 com.example webdav-deploy pom 1 Webdav Deployment POM org.apache.maven.wagon wagon-webdav-jackrabbit 2.2 +-------+ 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 "<<>>" 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 <> section. Just follow these steps: [[1]] In Archiva, click the <> 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.) * Drag and drop files 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 Saves files 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 ~~TODO: information for Maven 1, ant tasks, ivy, etc.