R/zz-cran-interface.R
copy_artifact.RdThis essentially runs a maven-dependency-plugin:copy goal to copy a JAR
file from (usually) a remote repository to a local directory. The directory
is under the users control but defaults to the .m2 repository.
copy_artifact(
groupId = NULL,
artifactId = NULL,
version = NULL,
...,
coordinates = NULL,
artifact = NULL,
outputDirectory = .working_dir(artifact),
repoUrl = .default_repos(),
nocache = FALSE,
verbose = c("normal", "quiet", "debug")
)optional, the maven groupId,
optional, the maven artifactId,
optional, the maven version,
other maven coordinates such as classifier or packaging
optional, coordinates as a coordinates object,
optional, coordinates as an artifact string
groupId:artifactId:version[:packaging[:classifier]] string
optional path, defaults to the rmaven cache
directory
the URLs of the repositories to check (defaults to maven
central, Sonatype snaphots and jitpack)
normally artifacts are only fetched if required, nocache
forces fetching
how much output from maven, one of "normal", "quiet", "debug"
the output of the system2 call. 0 on success.
# \donttest{
# This code can take quite a while to run as has to
# download a lot of plugins, especially on first run
tmp = copy_artifact("org.junit.jupiter","junit-jupiter-api","5.9.0")
#> [INFO] Scanning for projects...
#> [INFO]
#> [INFO] ------------------------------------------------------------------------
#> [INFO] Building Maven Stub Project (No POM) 1
#> [INFO] ------------------------------------------------------------------------
#> [INFO]
#> [INFO] --- maven-dependency-plugin:3.3.0:get (default-cli) @ standalone-pom ---
#> [INFO] Resolving org.junit.jupiter:junit-jupiter-api:jar:5.9.0 with transitive dependencies
#> [INFO] ------------------------------------------------------------------------
#> [INFO] BUILD SUCCESS
#> [INFO] ------------------------------------------------------------------------
#> [INFO] Total time: 3.816 s
#> [INFO] Finished at: 2024-04-24T19:35:48+00:00
#> [INFO] Final Memory: 15M/57M
#> [INFO] ------------------------------------------------------------------------
print(tmp)
#> /home/runner/.cache/rmaven/org.junit.jupiter_junit-jupiter-api_5.9.0/junit-jupiter-api-5.9.0.jar
# }