Uploading/Downloading Packages on the Self-Hosted Repo Page
Only repository administrators and developers can upload and download private packages. You can set repository roles on the Repository Permissions page.
Uploading a Package
- Click a project card to access the project. (If no project is available, create one.)
- Choose > from the navigation pane.
- In the left pane, click the target repository to which the private package is to be uploaded.
- Click Upload on the right of the page.
- In the Upload dialog box, specify parameters, select the file, and click Upload. Detailed configuration for each package type is described below.
- The Conan package cannot be uploaded on the page.
- The maximum file size for uploads is 100 MB for Maven, npm, PyPI, RPM, and Debian types, and 20 MB for NuGet.
- You are advised not to upload files containing sensitive information such as plaintext accounts and passwords to self-hosted repos.
Maven Artifacts
- Project Object Model (POM) is the basic working unit of a Maven project. It is an XML file that contains basic project information to describe how to build a project and declare project dependencies. When a build task is run, Maven searches for the POM in the current directory, reads its content, obtains the required configuration information, and builds the target package.
- Maven coordinates: X, Y, and Z are used to uniquely identify a point in the three-dimensional space. In Maven, GAV is used to identify a unique package. It stands for Group ID, Artifact ID, and Version. Group ID indicates a company or organization. For example, Maven core components are in the org.apache.maven organization. Artifact ID indicates the name of the package. Version indicates the version of the package.
- Maven dependencies are crucial for POM files. The building and running of most projects depend on the dependency on other components. Add the dependency list to your POM file. If the App component depends on the App-Core and App-Data components, the configuration is as follows:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.companyname.groupname</groupId> <artifactId>App</artifactId> <version>1.0</version> <packaging>jar</packaging> <dependencies> <dependency> <groupId>com.companyname.groupname</groupId> <artifactId>App-Core</artifactId> <version>1.0</version> </dependency> </dependencies> <dependencies> <dependency> <groupId>com.companyname.groupname</groupId> <artifactId>App-Data</artifactId> <version>1.0</version> </dependency> </dependencies> </project>
Uploading a Maven Artifact
POM and GAV upload modes are supported.
Upload Mode |
Description |
---|---|
POM |
GAV parameters are obtained from the POM file. The system retains transitive dependencies of components. |
GAV |
GAV, short for Group ID, Artifact ID, and Version, is the unique identifier of a JAR package. In this mode, GAV parameters are manually specified. The system automatically generates a POM file without any transitive dependency. |
- POM
In POM mode, you can either upload just the POM file or both the POM file and its related components. The uploaded file must match the artifactId and version values specified in the POM. As shown in the following figure, if the artifactId value is demo and the version value is 1.0 in the POM, then the uploaded file must be named demo-1.0.jar.
Figure 1 Uploading a package in POM modeThe POM file structure is as follows:
<project> <modelVersion>4.0.0</modelVersion> <groupId>demo</groupId> <artifactId>demo</artifactId> <version>1.0</version> </project>
The modelVersion tag must exist and the value must be 4.0.0, indicating that Maven2 is used.
If you upload files in both the POM and File area, the artifactId and version values in POM must match the file name in File. For example, if the artifactId value is demo and the version value is 1.0 in POM, then the uploaded file must be named demo-1.0 in File.
- GAV
In the GAV mode, the Group ID, Artifact ID, and Version parameters must be manually specified and they determine the name of the file to upload. Extension indicates the packaging type and determines the file type to be uploaded.
Classifier is used to differentiate artifacts that are built from the same POM but contain different contents. This field is optional. It can contain letters, digits, underscores (_), hyphens (-), and dots (.). If you specify this field, it will be appended to the file name.
Common Usage Scenario
- Differentiate versions by name, such as demo-1.0-jdk13.jar and demo-1.0-jdk15.jar.
- Differentiate usage by name, such as demo-1.0-javadoc.jar and demo-1.0-sources.jar.
Figure 2 Uploading a package in GAV mode
npm Packages
Node Package Manager (npm) is a JavaScript package management tool. An npm package is the item managed by npm, and the npm registry is used to store and manage these packages.
The npm package consists of a structure and file description.
- Package structure: organizes various files in a package, such as source code files and resource files.
- Description file: describes package information. Example: package.json, bin, and lib files
The package.json file in the package is a description file of a project or module package. It contains information such as the name, description, version, and author. The npm install command downloads all dependent modules based on this file.
An example of the package.json file is as follows:
{ "name": "third_use", //Package name "version": "0.0.1", //Version number "description": "this is a test project", // Description "main": "index.js", //Entry file "scripts": { //Script command "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ //Keyword "show" ], "author": "f", //Developer name "license": "ISC", //License agreement "dependencies": { //Project production dependencies "jquery": "^3.6.0", "mysql": "^2.18.1" }, "devDependencies": { //Project development dependencies "less": "^4.1.2", "sass": "^1.45.0" } }
The name and version are the most important fields and must exist. Otherwise, the current package cannot be installed. The two attributes together form the unique identifier of an npm package.
name indicates the name of the package. The first part of the name, such as @scope, is used as the namespace. The other part is name. Generally, you can search with the name field to install and use the required package.
{ "name": "@scope/name" }
version indicates the version of the package, which is in the x.y.z format.
{ "version": "1.0.0" }
Uploading an npm Package
npm packages in .tgz format can be uploaded to self-hosted repos. When uploading packages, you need to set the following parameters.
Parameter |
Description |
---|---|
PackageName |
The value must be the same as that of name in the package.json file. |
Version |
The value must be the same as that of version in the package.json file. |
When uploading a package, ensure that the PackageName starts with a path in the path list added during repository creation. For details, see Table 2 in the help guide.
Example:
The path @test is added when you create an npm registry.
When uploading the package to the registry, make sure that the PackageName starts with @test. If a path outside the path list is used, for example, @npm, the upload will fail.
After the upload is successful, you can find the package in .tgz format in the repository list and the corresponding metadata is generated in the .npm directory.
Uploading a Go Package
Go, also known as Golang, is a programming language developed by Google. Golang 1.11 and later support modular package management. A module is a unit for source code exchange and versioning in Go. A MOD file identifies and manages a module. A ZIP file is a source code package. There are two types of Go modules: v2.0 and later and v2.0 and earlier. The management of the Go module is different between these two versions.
To upload a Go package, you need to upload both a ZIP file and a MOD file and set the following parameters.
Parameter |
Description |
---|---|
zip path |
Complete path of the ZIP file. Valid path formats are:
|
zip file |
Directory structure of the ZIP file. Valid directory structure formats are:
|
mod path |
Complete path of the MOD file. Valid path formats are:
|
mod file |
MOD file content. Valid content formats are:
|
Uploading a PyPI Package
You are advised to go to the project directory (which must contain the setup.py configuration file) and run the following command to compress the package to be uploaded into a wheel (.whl) installation package. By default, this package is generated in the dist directory of your project directory. Note that the Python package management tool pip supports only wheel installation packages.
python setup.py sdist bdist_wheel
You need to set the following parameters.
Parameter |
Description |
---|---|
PackageName |
The value must be the same as that of name in the setup.py file. |
Version |
The value must be the same as that of version in the setup.py file. |
After the upload is successful, you can find the installation package in .whl format in the repository list. In addition, the corresponding metadata is generated in the .pypi directory, which can be used for pip installation.
Uploading an RPM Package
Introduction to RPM
- Red Hat Package Manager (RPM), developed by Red Hat, is used by many Linux distributions. It is a software management system that installs software on Linux in database recording mode.
- You are advised to package and name the RPM binary file according to the following rules:
Software name-Main version number of the software.Minor version number of the software.Software revision number-Number of software compilation times.Hardware platform suitable for the software.rpm
For example, hello-0.17.2-54.x86_64.rpm. hello is the software name, 0 is the major version number of the software, 17 is the minor version number, 2 is the revision number, 54 is the number of times that the software is compiled, and x86_64 is the hardware platform suitable for the software.
Software Name |
Major Version |
Minor Version |
Revision No. |
Compilation Times |
Applicable Hardware Platform |
---|---|---|---|---|---|
hello |
0 |
17 |
2 |
54 |
x86_64 |
Note: You need to set the following parameters when uploading packages.
Parameter |
Description |
---|---|
Component |
Component name |
Version |
Version of the RPM binary package |
- Go to the self-hosted repo page. In the left pane, click the target repository to which the private package is to be uploaded.
- Click Upload on the right of the page.
- Set the package parameters, select the file, and click Upload.
Figure 3 Uploading a package
After the upload is successful, you can find the RPM binary package in the repository list and the corresponding metadata repodata directory is generated in the package name directory. You can use Yum to install the package.
Uploading a Debian Package
When uploading a Debian package, you need to set the following parameters:
Parameter |
Description |
---|---|
Distribution |
Release version of the package |
Component |
Name of the package |
Architecture |
Package architecture |
Path |
Path for storing the package. By default, the package is uploaded to the root path. |
File |
Local storage path of the package to be uploaded |
After the upload is successful, you can find the installation package in .deb format in the repository list. In addition, the corresponding metadata is generated in the dists directory, which can be used for Debian installation.
Uploading a NuGet Package
A NuGet package is a single ZIP file with a .nupkg extension. As a shareable unit of code, developers can publish it to a dedicated server to share it with other team members.
CodeArts Artifact creates a NuGet repository to host and manage NuGet packages.
You are advised to package and name the NuGet file according to the following rules:
Software name-Major version number of the software.nupkg
Example: automapper.12.0.0.nupkg
- Go to the self-hosted repo page. In the left pane, click the target NuGet repository to which the private package is to be uploaded.
- Click Upload, select the NuGet file to be uploaded from the local PC, and click Upload.
- View the package that is successfully uploaded in the repository list.
metadata stores metadata and is named after the package name. metadata cannot be deleted manually. It will be deleted or added automatically when the corresponding package is deleted or restored.
package stores components.
Uploading a Docker Image
- Go to the self-hosted repo page. In the left pane, click the target Docker registry to which the private image is to be uploaded.
- Click Upload and configure page information (for details, see the following table).
Parameter
Description
Upload Mode
The default upload mode is Single file.
PackageName
Enter the image name.
File
Select the Docker file to be uploaded from the local PC.
- Click Upload.
When the progress bar in the lower right corner of the page shows 100%, it indicates the upload is complete.
Uploading a CocoaPods Package
- Go to the self-hosted repo page. In the left pane, click the target CocoaPods repository to which the private package is to be uploaded.
- Click Upload and configure page information (for details, see the following table).
Parameter
Description
Upload Mode
The default upload mode is Single file.
PackageName
Enter the package name.
File
Select the CocoaPods file to be uploaded from the local PC.
- Click Upload.
When the progress bar in the lower right corner of the page shows 100%, it indicates the upload is complete.
Uploading a Generic Package
- Go to the self-hosted repo page. In the left pane, click the target Generic repository to which the private package is to be uploaded.
- Click Upload and configure page information (for details, see the following table).
Parameter
Description
Upload Mode
Select Single file or Multiple files. Single file is selected by default here.
When Multiple files is selected, a maximum of 20 files can be uploaded at a time.
Path
After you set the path name, a folder with that name is created in the Repo View, where the uploaded package will be stored.
File
Select the Generic package to be uploaded from the local PC.
- Click Upload.
When the progress bar in the lower right corner of the page shows 100%, it indicates the upload is complete.
Uploading an OHPM Package
OHPM packages
OpenHarmony Package Manager (OHPM) is an ArkTS package management tool. OHPM manages packages, which are stored and organized in the OHPM repository.
The OHPM package contains the Harmony Archive (HAR) package and Harmony Shared Package (HSP) package.
- HAR: Static shared package, which is reused in the build phase. It is mainly used as a second-party or third-party library for other applications to depend on. It includes resource files, *.so files, and metadata files.
- HSP: Dynamic shared package, which is reused in the running phase It provides shared code and resources to improve code reusability and maintainability.
The metadata file, oh-package.json5, in the HAR package describes the component, including its name, version, and dependency information. The ohpm install command automatically reads the dependencies in oh-package.json5 and downloads them.
Example: oh-package.json5
{ "name": "@scope/demo", // Component name "version": "0.0.1", // Version "author": "artifact", // Author "license": "Apache-2.0", // License agreement "main": "index.ts", // Entry file "description": "basic information.", // Description "dependencies": { // Dependency "@scope/demo1": "1.0.0", "@scope/demo2": "file:./demo2.har" }, "devDependencies": { // Development dependency "@scope/demo3": "1.0.0", "@scope/demo4": "1.0.0" }, "metadata": { // Metadata information "sourceRoots": ["./src/main"] } }
The name and version are the most important fields and must exist. Otherwise, the current package cannot be installed. The two attributes together form the unique identifier of an OHPM package.
name indicates the name of the package. The first part of the name, such as @scope, is used as the namespace. The other part is name. Generally, you can search with the name field to install and use the required package.
{ "name": "@scope/name" }
version indicates the version of the package, which is in the x.y.z format.
{ "version": "1.0.0" }
Uploading an OHPM package
You can upload OHPM packages in .har or .hsp format to the self-hosted repo. The procedure is as follows:
- Go to the self-hosted repo page. In the left pane, click the target OHPM repository to which the private package is to be uploaded.
- Click Upload and configure page information (for details, see the following table).
Parameter
Description
Upload Mode
The default upload mode is Single file.
PackageName
Enter the package name. The value must be the same as that of name in the oh-package.json5 file.
Ensure that the PackageName starts with a path in the path list added during repository creation. For details, see Table 2 in the help guide.
Example:
The path @test is added when you create an OHPM repository.
When uploading the package to the repository, make sure that the PackageName starts with @test. If a path outside the path list is used, for example, @ohos, the upload will fail.
Version
Enter the version number. The value must be the same as that of version in the oh-package.json5 file.
File
Select the OHPM file to be uploaded from the local PC.
- Click Upload.
When the progress bar in the lower right corner of the page shows 100%, it indicates the upload is complete.
You can find the package in the repository list and the corresponding metadata is generated in the .ohpm directory.
Downloading a Package
- Go to the self-hosted repo page. In the left pane, locate the package to be downloaded, and click its name.
If there are too many repositories or packages, you can search for the desired one by referring to Searching for a Package.
- Click Download on the right of the page.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot