ProGet Documentation

Maven Feeds in ProGet

  • Last Modified: 2021-01-13

Maven feeds contain a maven2-compatible Maven artifact repository. Maven works a little differently than the other feed types.

Maven Specifics

Maven artifacts are not self-contained archives; instead, an artifact is more of a grouping of files with some associated metadata. Because of this distinction, Maven feeds do not support drop path imports.

Connectors are also slightly different in Maven than in most other feed types. As there is no universal standard for searching or listing from a remote Maven repository, ProGet uses a rather dated API that provides an index of all artifacts. A task in the ProGet service will periodically download that index and unpack it to a local Lucene database, and use that for searching the remote repository. For the public Apache Maven repository, this can be a very resource-intensive operation, and if you do not need this searching capability, we recommend disabling this task in ProGet. Artifacts accessed directly by name do not need this index.

As of ProGet 5.1.0, Maven feeds support alternate package stores (AWS, Azure).

Adding a Repository

There are two different ways to add a ProGet Maven feed as an additional Maven repository. The first way is to specify the feed in the POM xml. Within the project > respoitories element, you would add a repository element identifying the ProGet feed. For Example:

<project>
...
    <repositories>
        <repository>
            <id>ProGet</id>
            <name>{Maven-Feed-Name}</name>
            <url>{Maven-API-endpoint-url}</url>
        </repository>
    </repositories>
...
</project>

The other way to specify the feed is to create a profile in the {USER_HOME}\.m2\settings.xml file. An example profile is:

<settings>
    ...
    <profiles>
    ...
    <profile>
        <id>ProGetProfile</id>
        <repositories>
            <repository>
                <id>ProGet</id>
                <name>{Maven-Feed-Name}</name>
                <url>{Maven-API-endpoint-url}</url>
            </repository>
        </repositories>
    </profile>
    ...
    </profiles>
     
    <activeProfiles>
        <activeProfile>myprofile</activeProfile>
    </activeProfiles>
    ...
</settings>

For more information on adding additional Maven repositories, see Maven's (Setting up Multiple Repositories)[https://maven.apache.org/guides/mini/guide-multiple-repositories.html] guide.

Authenticating to Maven Feeds

Authentication settings for the maven client is configured in your settings.xlm file. You can use the standard <username> and <password> elements to store a username/password for ProGet, or you can specify api as the username, and an API Keys as a password.

Local Indexing

Maven uses a local Lucene database. This indexing is performed on a schedule. To trigger the index task manually, navigate to Admin > Scheduled Jobs and select FullMavenConnectorIndex. If this connector index is not available, go to Admin > Service page and trigger the Scheduled Job Dispatcher. This will re-configure any missing connector index-scheduled jobs.

Bulk Importing

ProGet does not currently import drop paths for Maven; the precise reason is complex, but it's ultimately a result of the way Maven is structured (i.e. a file system vs packages), and how files can be added piece-meal. It is something we are considering adding in a future release, however. Please consider adding to the existing discussion on our forums.

Other users have reported that they've used a process like this for a disk-based repository.

  1. Traverse all directories and upload all POM files with a path relative to the root
  2. Traverse all directories again, and upload all non-POM and non-checksum files (like .md5)

There will be errors, particularly if you have invalid POM files or your directory structure doesn't match the required MAVEN convention, so inspect those case-by-case to determine if it matters (like an bad artifact from 5 years ago can probably be ignored).

Is this documentation incorrect or incomplete? Help us by contributing!

This documentation is licensed under CC-BY-SA-4.0 and stored in GitHub.

Generated from commit 99e6640e on master