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.
An XML file that contains configuration about how to build the application. Usually, the file is saved as
Displays and allows you to browse artifacts of the project’s Maven repository.
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.
- In the navigation bar, click Maven .
- On the right side of the page, click Upload.
- In the Upload Artifacts section, use the drag-and-drop operation to drop files to the drop area, or click the select artifact files link, browse, and select the files.
- In the table below the Upload Artifacts section, if necessary, update the Classifier field of the selected artifact.
If you’re uploading only one artifact, you can leave the classifier field empty. If you’re uploading multiple artifacts, provide the classifier value for each artifact. The classifier helps to distinguish artifacts that were built from the same POM file but differ in their content. The classifier string is appended to the artifact name, after the version number.
For example, if you’re uploading artifacts with identical names but different extensions (such as
fileX-1.0.pdf), you may provide classifiers, such as
documentationfor these files. After the files are uploaded, they are renamed to
- After you add the artifacts, you must specify their Maven coordinates manually or from a POM file. These coordinates are used when uploading artifacts to the project’s Maven repository.
If you want to specify the artifacts’ Maven coordinates manually, note the following:
The auto-suggest list of GroupId, Version, and ArtifactId are based on Maven indexes. If no index data is available, the auto-suggest list isn’t displayed.
By default, the Generate POM check box is selected. The upload process deploys the artifact and generates the default POM file,
maven-metadata.xml, and associated
sha1/md5checksum files. If
maven-metadata.xmlalready exists, it’s updated.
If you deselect the check box, the upload process deploys the artifact to the target deployment path based on Maven attributes. The POM file and the
maven-metadata.xmlfile aren’t generated.
- Click Start Upload.
You can track the transfer status and its progress in the drop area of the Upload Artifacts section. To cancel the upload process, click Cancel Upload. The upload process will also be cancelled if the page is refreshed or closed.
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.
- Download and install Maven on your local computer.You can download Maven from
MVN_HOME/conf/settings.xmlin a text editor and make the following changes.
- Specify the proxy server, if necessary.Example:
<proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>PROXY_URL</host> <port>80</port> <nonProxyHosts>www.anything.com|*.somewhere.com</nonProxyHosts> </proxy> </proxies>
- Specify a unique ID and your DevCS user name and password to access the project Maven repository.Example:
<servers> <server> <id>remoteRepository</id> <username>USERNAME</username> <password>PASSWORD_IN_PLAINTEXT</password> </server> </servers>
- Specify a unique ID, name, and URL for the project Maven repository. You can copy the Maven repository URL from the Repositories tab of the Project Home page.Example:
<profiles> <profile> <id>default</id> <repositories> <repository> <id>remoteRepository</id> <name>My Remote Repository</name> <url>dav:https://developer.us2.oraclecloud.com/……/maven/</url> <layout>default</layout> </repository> </repositories> </profile> </profiles>
- Specify the proxy server, if necessary.
- Open the command-line and follow these commands to upload files to the hosted Maven repository. Ensure that the
MVN_HOME/binpath is available in the
- Navigate to the directory that contains the files that you want to upload.
- Create the
pom.xmlfile, if it hasn’t been created already.For more information about
- Run the
mvn deploycommand to upload files.Example:
mvn deploy:deploy-file -DpomFile=c:\myproject\pom.xml -Dfile=c:\myproject\myfile.jar -DrepositoryId=remoteRepository -X -Durl=dav:https://developer.us2.oraclecloud.com/……/maven/
To search for artifacts, use the Artifact Search view.
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.
- In the navigation bar, click Maven .
- If necessary, on the right side of the page, click Browse.
- Browse and select the artifact that you want to download.You can also click Artifact Search to search for the artifact and then click its name to open it in the Browse view.
- With the artifact selected, in Artifact Details on the right, click Download .
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.
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.