Manage Binaries and Dependencies Using the Project’s Maven Repository
When a project is created, Oracle Developer Cloud Service (DevCS) creates a hosted Maven repository in the project, which is also called as the project Maven repository. You can use the repository to store binary files and dependencies. If you’re developing Maven applications, you can use the Maven repository to store and access build artifacts.
If you see the No Storage Configured error message, contact the Organization Administrator (a user with the Developer Service Administrator identity domain role) to enable the storage configuration of the organization. If you’re the Organization Administrator, configure the storage configuration of the organization. See Connect to OCI or OCI Classic.
Maven Concepts and Terms
Apache Maven is a software project management tool that uses the Project Object Model (POM) concept to manage a project's build.
If you’re new to Maven, see https://maven.apache.org
to learn about Maven basics such as POM files and Maven repositories.
In DevCS, you use the project’s Maven repository to store build artifacts and dependencies for your project’s applications. Usually, you store the dependencies on the project’s Maven repository that aren’t available on a public Maven repository, such as Maven Central Repository or Oracle Maven Repository.
Here are the terms that this documentation uses to describe the Maven terms and components of a project.
Term | Description |
---|---|
POM file |
An XML file that contains configuration about how to build the application. Usually, the file is saved as |
Browse view |
Displays and allows you to browse artifacts of the project’s Maven repository. |
Upload view |
Allows you to upload artifacts manually to the project’s Maven repository. |
Artifact Search view |
Enables you to search artifacts in the project’s Maven repository. |
To upload and access the files of the repository programmatically, configure the POM file of your application. You can use the project Maven repository among other projects of the organization for local builds as well as project builds.
Upload an Artifact Manually
From the Upload view, you can upload artifacts manually to the project’s Maven repository without installing Maven on your computer. You must be a project owner or member to upload an artifact to the project Maven repository.
Upload Artifacts Using the Maven Command-Line Interface
You can also use the Maven command-line interface to upload artifacts to the project’s Maven repository.
The Maven repository URL is available on the Project Home page of your project. Use the dav:
URL to upload files and the http://
URL to view them in the browser.
Note that the credentials in settings.xml
aren’t required to access the project Maven repository when running a build. The build job has full access to the project Maven repository for uploads and downloads.
Search Artifacts
To search for artifacts, use the Artifact Search view.
-
GroupID
-
ArtifactID
-
Version
-
Classifier
-
Size and updated date (available in Show Advanced Options)
The search result is grouped by Maven coordinates in the Artifacts (default) tab and by files in the Files tab.
Download an Artifact Manually
You can download an artifact manually from the Browse view of the Maven page.
Copy Distribution Management Snippets
To upload or download dependencies while running a build, add the dependency management snippet or the dependency declaration snippet to the POM file.
Action | How To |
---|---|
Copy the Dependency Management snippet |
|
Copy the Dependency Declaration snippet |
|
Tip:
You can copy the Maven repository’s URL from the distribution snippet. You can also copy the URL from the Project Home page.On the Project Home page, click the Repositories tab. In the Maven section, from the Clone menu of Project Repository, select HTTP or Webdav, and click Copy to copy the URL to clipboard.
Use the HTTP URL to connect to the Maven repository using the HTTP protocol. Use the Webdav URL to connect to the repository using the Webdav protocol.
Maven Repository Administration
You can configure the Maven repository to limit the number of snapshots and overwrite an artifact if another with same groupID, artifactID, and version value is uploaded.
Configure Auto-Cleanup of Snapshots
By default, when you upload a new snapshot of an artifact to the project’s Maven repository manually or through job builds, the repository retains the old versions of the snapshots. You can configure the project to remove the old versions when a new version is uploaded.
- In the navigation bar, click Project Administration .
- Click Repositories.
- In Maven Repository, if necessary, expand Configure auto cleanup for Snapshot versions.
- Select the Purge check box.
- In Default Max Snapshots, enter a number between 2 and 500 to specify the maximum versions to retain. By default, 2 versions of the snapshots are retained.
All changes are saved automatically when you navigate to another field. After the rule is enabled, any new upload of a snapshot will remove its older versions if the number of snapshots exceed the value in Default Max Snapshots.
You can also add exceptions to the auto-cleanup and Default Max Snapshots rule and customize the snapshot counts. The project Maven repository retains the snapshot counts of group IDs and artifacts defined in the Customized Snapshot Counts section and uses the default value specified in Default Max Snapshots for artifacts that don’t have exceptions defined.
To define exceptions and customize snapshot count:
-
In the Maven Repository section of the Repositories page, select the Purge check box and configure the default auto-cleanup as described above.
-
To add an artifact group or an artifact name as an exception, click + Add in the Customized Snapshot Counts section.
-
Specify these details:
-
Group Id (Required): Enter or select the Group ID of the artifact. You can select the ID from the list or start typing and then select the ID from the list of suggestions. The auto-suggest list is based on the Maven indexes. If no index data is available, the auto-suggest list doesn’t display.
-
Artifact Id (Optional): Enter or select the Artifact ID of the artifact. You can select the ID from the list or start typing and then select the ID from the list of suggestions. The auto-suggest list is based on the Maven indexes. If no index data is available, the auto-suggest list doesn’t display.
-
Snapshot Count: Select the number of snapshots to retain in the project Maven repository. By default, 2 snapshots are retained.
-
To remove an exception, on the right, click Remove . For a long list of exceptions, you can use the Filter field and enter a search coordinates criteria to see the exceptions matching the criteria. If you enter an exception with duplicate coordinates, an error message Unable to save. Coordinates already exists. Enter unique coordinates
appears.
Configure Overwrite for Artifacts
By default, when a user tries to upload a Maven release artifact with the same groupID, artifactID, and version values of an existing artifact to the project’s Maven repository, the upload fails. If a build tries to upload an artifact with duplicate groupID, artifactID, and version values, it fails too. To allow the duplicate artifact to be uploaded, you can configure the project’s Maven repository to allow the build to upload artifacts with duplicate groupID, artifactID, and version values.
- In the navigation bar, click Project Administration .
- Click Repositories.
- In Maven Repository, if necessary, expand Configure Overwrite Property for Release Artifacts.
- Select the Allow check box.