To enable calculation of CRAN metadata, in the Administration module, go to Repositories | Repositories | Local and select CRAN as the Package Type when you create your local repository.
You need to maintain a specific path structure in order to manage the CRAN packages that are uploaded to CRAN local repositories.
CRAN packages are uploaded to the following locations:
src/contrib/ArtifactoryRDS_0.1.0.tar.gz
./myfirstpkg_1.2.tg
z.Artifactory will find your packages by performing a property search causing the folder hierarchy not to have an impact on performance.
When uploading a CRAN package via the UI, the default deploy path is not enforced but is recommended since it allows Artifactory to manage the CRAN packages. Uploading the packages to a different path will cause the packages not to be identified as CRAN packages. |
You can create CRAN remote repository to proxy and cache remote repositories or other Artifactory instances.
Note that the index files for remote CRAN repositories are stored and renewed according to the Retrieval Cache Period setting.
A Virtual Repository in Artifactory aggregates packages from both local and remote repositories. This allows you to access both locally hosted CRAN packages and remote proxied CRAN libraries from a single URL defined for the virtual repository.
To create a virtual CRAN repository, set CRAN as the Package Type, and select the underlying local and remote CRAN repositories to include under the Repositories section.
1. Run the Set Me Up for CRAN.
2. To switch from the current repository to a different resolution CRAN repository.
setRepositories() |
3. View all the available packages for the selected CRAN repository.
available.packages() |
4. Install a package from the CRAN repository.
install.packages() - select from a list, on supported clients install.packages("package") - install by package name |
You can deploy packages to a local or virtual CRAN repository using the Deploy feature in the UI or using a POST request.
The CRAN metadata is automatically calculated and updated when adding, removing, copying or moving CRAN packages. The calculation is only invoked after a package-related action is completed. |
To deploy CRAN packages to a virtual CRAN repository, make sure you have set the Default Deployment Repository.
You can drag and drop, or select a CRAN package to upload in Deploy in the UI. Artifactory will identify if it's a source or binary package.
Artifactory supports two types of packages: binaries and sources. They are treated differently in terms of the deployment in the UI.
When deploying sources deploy, the Target Path is automatically displayed and we recommend not changing this path. Changing the src/contrib
path will result in Artifactory not identifying the package as a CRAN package since Artifactory will not be able to index it.
The Target path is automatically updated and changing it could make Artifactory not invoke the metadata calculation, and this package to not get indexed. |
In binary deploy, you'll need to fill the CRAN Artifact section.
In the CRAN Artifact section, configure these fields when deploying the CRAN packages. It is mandatory to set these fields and are used to create the destination path of the deployed binary package.
The Target path is updated after the file is deployed and there is no need to change it |
curl -XPOST "http://localhost:8080/artifactory/api/cran/cran-local/sources" -T package_1.0.tar.gz |
curl -XPOST "http://localhost:8080/artifactory/api/cran/cran-local/binaries?distribution=macosx/el-capitan&rVersion=3.5" -T package_1.0.tgz curl -XPOST "http://localhost:8080/artifactory/api/cran/cran-local/binaries?distribution=windows&rVersion=3.5" -T package_1.0.zip |
When deploying a CRAN binary package, you need to specify the distribution and R version as before.
When deploying directly (PUT request to a specific path), make sure the target path is a valid CRAN path:
/src/contrib
for sourcesbin/{distribution}/contrib/{r-version}
for binaries.Deploying a package to a different path will not identify the package as CRAN packages, and will not invoke the metadata indexing.
From Artifactory version 7.41.1, you can set the artifacts stored in local CRAN the repositories to confine to the official CRAN spec requirements.
Set the following system property in the Artifactory.yml file to save your CRAN archives in the correct hierarchy.
"cran.archiveMover.enabled" |
You can move your existing Archives to the correct path using the following Move CRAN Archives REST API. Requires the cran.archiveMover.enabled
to be enabled. Add a link
In the Artifact Repository Browser, select your virtual CRAN repository and scroll down to find and select the package you want to inspect. The metadata is displayed in the CRAN Info tab.
You can trigger an asynchronous reindexing of a local CRAN repository either through the UI or using the REST API.
Through the UI, select your CRAN repository in the Tree Browser and select Recalculate Index from the right-click menu as shown below (requires Admin privileges)
To reindex a CRAN repository through the REST API, please refer to Calculate CRAN Repository Metadata.