Help Center>
CloudArtifact>
FAQs>
Self-Hosted Repo>
How Do I Upload Snapshots to the Self-Hosted Maven Repo?
Updated on 2022-09-29 GMT+08:00
How Do I Upload Snapshots to the Self-Hosted Maven Repo?
Background
Snapshots can be uploaded in the following modes:
Uploading Snapshots
- Log in to the DevCloud homepage.
- On the top navigation bar, choose .
- Click the snapshot repository in the repository list. Click Upload. In the Upload snapshot Component dialog box displayed, select the GAV definition mode as required.
There are two GAV definition modes.
GAV Definition Mode
Description
POM
GAV information is extracted from POM files.
GAV
GAV information is manually specified.
- Set related parameters as prompted and upload the corresponding package.
Uploading Snapshots Using the Maven CLI
- Access the self-hosted Maven repo homepage, and choose the snapshot repository in the repository list.
- In the upper right corner, choose .
- Configure the local Maven tool by following the configuration guide.
- Run mvn deploy to upload the Maven project.
In the Maven CLI, access the directory where the pom.xml file of the Maven project is stored, then run the following command to upload a local JAR package:
mvn deploy:deploy-file -DgroupId=com.huawei -DartifactId=aopalliance -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=D:\aopalliance-1.0-SNAPSHOT.jar -Durl={Maven Snapshot address} -DrepositoryId=snapshots
- Set DgroupId, DartifactId, Dversion, and Dpackaging as required.
- Set Dfile to the absolute path of the local JAR package.
- Set Durl to the Maven snapshot address, which can be obtained by clicking
in the preceding figure.
Releasing Snapshots to the Self-Hosted Maven Repo Through CloudBuild
- Access the code repository, open the pom.xml file, and define the GAV information of the component to upload.
- When a build task is run, CloudBuild identifies the component attributes uploaded to the private Maven repository based on the definition.
- version: Releases are uploaded by default. To upload a snapshot, add the suffix -SNAPSHOT to the value of version, for example, 1.0-SNAPSHOT.
- Edit a build task. Specifically, in the build action Build with Maven:
- In the command box, comment out the mvn package command (add # before the command) and uncomment the mvn deploy command (delete # before the command).
- Click Release Package to CloudArtifact, and select Configure all POMs.
- Run the build task. After the build task is executed, you can find the generated Maven component in the private Maven repository.
Parent topic: Self-Hosted Repo
Self-Hosted Repo FAQs
- How Do I Upload Snapshots to the Self-Hosted Maven Repo?
- How Do I Call a Private Component from a Self-Hosted Maven Repo?
- Can I Invoke Software Packages in CloudArtifact During Local Build?
- Why Is Error Code 500 Returned When a Gradle Build Task Uploads a Maven Package?
- Why Can't the Repository Receive Requests?
- Why Did the Dependency WAR or JAR Files Fail to Be Downloaded?
- Why Is Error 401 Returned When Uploading Maven Components to CloudArtifact?
- Files in the Recycle Bin of a Self-Hosted Repo Cannot Be Restored
Feedback
Was this page helpful?
Provide feedback
Thank you very much for your feedback. We will continue working to improve the
documentation.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbotmore