Help Center/ CodeArts Artifact/ User Guide/ Self-Hosted Repos 2.0/ Uploading/Downloading Components on the Client/ Downloading Components from Self-Hosted Repos on the Client
Updated on 2024-10-16 GMT+08:00

Downloading Components from Self-Hosted Repos on the Client

Downloading a Maven Component on the Client

  • The client tool is Maven. Ensure that the JDK and Maven have been installed.

    1. Download the settings.xml file from the self-hosted repo page and replace the downloaded configuration file with the new one or modify the settings.xml file of Maven as prompted.

    2. Run the following commands to download the client:
    mvn dependency:get -DremoteRepositories={repo_url} -DgroupId={groupId} -DartifactId={artifactId} -Dversion={version} -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true

Downloading an npm Component on the Client

  • The client tool is npm. Ensure that node.js (or io.js) and npm have been installed.

    1. Download the NPMRC file from the self-hosted repo page and save the downloaded NPMRC file as an .npmrc file.

    2. Copy the file to the user directory. In Linux, the path is ~/.npmrc. In Windows, the path is C:\Users\<UserName>\.npmrc.

    3. Go to the npm project directory (where the package.json file is stored) and run the following commands to download the npm dependency component:
    npm config set strict-ssl false
    npm install ––verbose

Downloading a PyPI Component on the Client

  • The client tools are python and pip. Ensure that python and pip have been installed.

    1. Download the pip.ini file from the self-hosted repo page and copy the file to the user directory. In Linux, the path is ~/.pip/pip.conf (C:\Users\<UserName>\pip\pip.ini on Windows)

    2. Run the following command to install Python:
    pip install {package name}

Downloading a Go Component on the Client

Certificate verification cannot be bypassed on the Go client. You need to add the domain name certificate corresponding to the self-hosted repo to the local certificate trust list and perform the following steps to add the trust certificate:

  1. Export the certificates.
    openssl s_client -connect {host}:443 -showcerts </dev/null 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' |openssl x509 -outform PEM >mycertfile.pem
    openssl x509 -outform der -in mycertfile.pem -out mycertfile.crt

    mycertfile.pem and mycertfile.crt are the downloaded certificates.

  2. Add the certificates to the root certificate trust list.
  3. Run the go commands to download the dependency package.
    ##1. Packages of versions earlier than v2.0
    go get -v <moudlename>
    ##2. v2.0 and later versions
    ##a. The ZIP package contains go.mod and the path ends with /vN.
    go get -v {{moduleName}}/vN@{{version}}
    ##b. The ZIP package does not contain go.mod or the first line in go.mod does not end with /vN.
    go get -v {moduleName}}@{{version}}+incompatible

Downloading an RPM Component on the Client

The following section uses the RPM component from Uploading an RPM Component on the Client as an example to describe how to obtain dependency packages from the RPM repository.

  1. Download the RPM configuration file by referring to 2 and 3.
  2. Open the configuration file, replace all {{component}} in the file with the value of {{component}} (hello in this file) used for uploading the RPM file, delete the RPM upload command, and save the file.
  3. Save the modified configuration file to the /etc/yum.repos.d/ directory on the Linux host.

  4. Run the following command to download the RPM component: Replace hello with the actual value of component.

    yum install hello

Downloading a Conan Component on the Client

  1. Select the target Conan repository from the self-hosted repo page and click Tutorial on the right to download the configuration file.

    You can replace local Conan configurations with the obtained configuration file (the path is ~/.conan/remotes.json in Linux or C:\Users\<UserName>\.conan\remotes.json in Windows).

  2. Run the following commands to download the Conan dependency package from the remote repository.

    $ conan install ${package_name}/${package_version}@${package_username}/${channel} -r=cloud_artifact

  3. Run the following command to check the downloaded Conan software package.

    $ conan search "*"

  4. Run the following commands to remove the software package from the local cache.

    $ conan remove ${package_name}/${package_version}@${package_username}/${channel}

Downloading a NuGet Component on the Client

Ensure that you have installed the NuGet.

  1. Select the target NuGet repository from the self-hosted repo page and click Tutorial on the right to download the configuration file NuGet.txt.

  2. Open the file, find the command under NuGet add source, and add the source.

    ##----------------------NuGet add source----------------------##
    nuget sources add -name {repo_name} -source{repo_url} -username {user_name} -password {repo_password}

  3. Open the file, find the statement under NuGet Download, replace <PACKAGE> with the name of the component to be downloaded, and run the download statement. (If a configuration source exists, use the configured source name as the parameter following -source.)

    ##----------------------NuGet Download----------------------##
    nuget install <PACKAGE>

Downloading a .NET Component on the Client

Ensure that you have installed the .NET.

  1. Select the target NuGet repository from the self-hosted repo page and click Tutorial on the right to download the configuration file dotnet.txt.

  2. Open the configuration file, find the command under dotnet add source, and add the source.

    ##----------------------dotnet add source----------------------##
    dotnet nuget add source {repo_url} add -n {repo_name} -u {user_name} -p {repo_password}

  3. Find the statement under dotnet download, replace < PACKAGE > with the name of the component to be downloaded, and run the download statement.

    ##----------------------dotnet download----------------------##
    dotnet add package <PACKAGE>

Downloading a Docker Component on the Client

Prerequisites

  • You have installed the Docker client.
  • You have created a Docker repository in the self-hosted repo.
  • Run the following commands on the Docker client to modify the configuration and ignore the certificate:
    vi /etc/docker/daemon.json
    {
      "insecure-registries": ["url"] 
    }

    {url}: repository path, as shown in the following figure.

    Downloading a Docker component on the client

    Run the following command on the local client to download the Docker component:

    sudo docker pull {url}/${image_name}:${image_version}

    url: repository path.

    image_name: component name.

    image_version: component version.

Downloading a CocoaPods Component on the Client

Prerequisites

  • You have installed the Ruby client and cocoapods-art plug-in.
  • You have created a CocoaPods repository in the self-hosted repo.

Downloading the provided configuration file to download CocoaPods components

  1. Select the target CocoaPods repository from the self-hosted repo page and click Tutorial on the right of the page.
  2. Select Download the provided configuration file.
  3. In the Select purpose area, click Download.
  4. Run the following commands to download the local client:

    Run the following command to download the component from the remote repository:

    pod repo-art add {package_name} {url}

    package_name: name of the CocoaPods dependency package to be downloaded.

    url: repository path of the self-hosted repo.

    Run the following command to change the path of the CocoaPods repository:

    pod repo-art update {package_name} {url}

    package_name: The CocoaPods dependency package cannot be modified.

    url: enter the repository path of the target self-hosted repo.

    Run the following command to display the downloaded components.

    pod repo-art list

    Run the following command to remove the local dependency package.

    pod repo-art remove <repo-name>//repo_name: name of the CocoaPods dependency package.

Following the command line configuration to download the CocoaPods components

  1. Select the target CocoaPods repository from the self-hosted repo page and click Tutorial on the right of the page.
  2. Select Follow the command line configuration.
  3. Run the following command to check whether the Rudy client has been installed:

    rudy -v

  4. Run the following command to install the cocoapods-art plug-in:

    sudo gem install cocoapods-art

  5. Run the following command to add the self-hosted repo to your CocoaPods client.

    pod repo-art add <repo_name> "{url}"

    repo_name: name of the folder for storing components of self-hosted repos on the local client.

    url: repository path of the CocoaPods repository.

  6. In the Select purpose area, click Download.
  7. Run the following commands to download the local client:

    Run the following command to download the component from the remote repository:

    pod repo-art update {package_name}//package_name: component name.

    Run the following command to display the downloaded components.

    pod repo-art list

    Run the following command to remove the local dependency package.

    pod repo-art remove <repo-name>//repo-name: name of the CocoaPods dependency package