Maven: 8 - Apache Archiva

Apache Archiva™: The Build Artifact Repository Manager

https://archiva.apache.org/

Apache Archiva™ is an extensible repository management software that helps taking care of your own personal or enterprise-wide build artifact repository. It is the perfect companion for build tools such as Maven, Continuum, and ANT.

Archiva offers several capabilities, amongst which remote repository proxying, security access management, build artifact storage, delivery, browsing, indexing and usage reporting, extensible scanning functionality… and many more! Get the latest updates, follow us on twitter @archiva.

And in case you were wondering, it is pronounced ahr-kahy-vuh, like archive but with an a!

1

Take a look around

Take a look at the screenshots in the feature walkthrough.

3

Documentation

Simple out of the box configuration and quick start guide
Read the users guide and administration documentation
For security issues, read the security vulnerabilities document
Documentation is also available for previous versions

4

Get involved

Get support from the mailing lists and wiki, file issues, and even get involved in the development.

Videos

Quick start

Browsing/Uploading/Searching

License

Archiva is distributed under the Apache License, version 2.0

Thanks

We would like to thank all the sponsors that provide financial assistance to the Apache Software Foundation. For more information on how you can support the foundation, see the sponsorship page.

Resources

Need more? Try some of these resources.

Books


Apache Maven 2: Effective Implementation (Maria Odea Ching, Brett Porter; September 2009)
Build and manage applications with Maven, Continuum and Archiva


Java Power Tools (John Smart; April 2008)
Contains a section on Archiva and repository management

 

Articles, Presentations and Tutorials


Installing Archiva

https://archiva.apache.org/docs/2.2.3/quick-start.html

The quickest way to install Archiva is to download and use the standalone distribution. This includes a bundled Jetty server which can be easily started. For more information on advanced configuration of this instance, refer to the Administration Guide.

To get started right away, you can run the following after unpacking:

./bin/archiva console (Linux, Mac, Solaris)
.\bin\archiva.bat console (Windows)

You will need to choose a different start command based on your platform. The console argument starts the server with the logs going to standard output, and waits for Ctrl+C to stop the server.

Archiva is now running on http://localhost:8080/

Setting up your Archiva instance

You can now browse the web administration of Archiva. There will be a few basic setup tasks to get started.

The first step is to setup your administration user. The password requires a numerical character and must not be longer than 8 chars. You'll then need to log in. Use 'admin' as the username and the password you've entered.

At this point, Archiva is fully functional - you can use it with the default repositories and guest user. You might like to explore the user and administrator guides to find other functionality.

The default configuration for Archiva configures two repositories:

  • internal - a repository for containing released artifacts. This is connected by proxy to the central repository, so requests here will automatically retrieve the remote artifacts.
  • snapshots - a repository for storing deployed snapshots. This is not proxied to any remote repositories by default.

In addition, the guest user has read access to these repositories, so you can make anonymous requests to either. To try this out, point a web browser at the following URL: http://localhost:8080/repository/internal/junit/junit/3.8.1/junit-3.8.1.jar. Though the artifact is not present locally, you will see in the Archiva logs that it is downloaded from the central repository, and then handed back to the browser and downloaded from Archiva. Future requests for the artifact will be much faster as they need not be downloaded from the central repository.

Once this artifact is downloaded, Archiva automatically indexes it, so you can access its information at the following URL: http://localhost:8080/index.html#artifact/junit/junit. It will also be available from the search interface.


Users Guide

https://archiva.apache.org/docs/2.2.3/userguide/index.html

Welcome to the Archiva user's guide. Getting to know and use Archiva is very simple - please select one of the following documents to learn how to use Archiva quickly.


Deploying to Repository

https://archiva.apache.org/docs/2.2.3/userguide/deploy.html

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>
      <!-- omitted xml -->
      <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>
        <!-- omitted xml -->
      </servers>
      <!-- omitted xml -->
    </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>
  <!-- omitted xml -->
  <distributionManagement>
    <repository>
      <id>archiva.internal</id>
      <name>Internal Release Repository</name>
      <url>http://reposerver.mycompany.com:8080/repository/internal/</url>
    </repository>
    <snapshotRepository>
      <id>archiva.snapshots</id>
      <name>Internal Snapshot Repository</name>
      <url>http://reposerver.mycompany.com:8080/repository/snapshots/</url>
    </snapshotRepository>
  </distributionManagement>
  <!-- omitted xml -->
</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>
      <!-- omitted xml -->
      <distributionManagement>
        <repository>
          <id>archiva.internal</id>
          <name>Internal Release Repository</name>
          <url>dav:http://reposerver.mycompany.com:8080/repository/internal/</url>
        </repository>
        <snapshotRepository>
          <id>archiva.snapshots</id>
          <name>Internal Snapshot Repository</name>
          <url>dav:http://reposerver.mycompany.com:8080/repository/snapshots/</url>
        </snapshotRepository>
      </distributionManagement>
      <!-- omitted xml -->
    </project>
  2. Add a build extension to your pom.xml (not required in Maven 2.0.9 and above)
    <project>
      <!-- omitted xml -->
      <build>
        <extensions>
          <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-webdav-jackrabbit</artifactId>
            <version>2.2</version>
          </extension>
        </extensions>
      </build>
      <!-- omitted xml -->
    </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 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-jackrabbit</artifactId>
        <version>2.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.)
    • 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)
Upload Artifact
Tags