.m2 repositoryR/zz-cran-interface.R
fetch_artifact.RdThis can be used to get a JAR file from the maven repositories into a
local .m2 repository. The local path is made available for importing it into
the rJava classpath for example.
fetch_artifact(
groupId = NULL,
artifactId = NULL,
version = NULL,
...,
coordinates = NULL,
artifact = NULL,
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, but if not supplied groupId and artifactId
must be, coordinates as a coordinates object (see as.coordinates())
optional, coordinates as an artifact string
groupId:artifactId:version[:packaging[:classifier]] string
the URLs of the repositories to check (defaults to Maven
central, 'Sonatype' snapshots and 'jitpack', defined in
options("rmaven.default_repos"))
normally artifacts are only fetched if required, nocache
forces fetching
how much output from maven, one of "normal", "quiet", "debug"
the path of the artifact within the local maven cache
# \donttest{
# This code can take quite a while to run as has to
# download a lot of plugins, especially on first run
fetch_artifact(artifact="com.google.guava:guava:31.1-jre")
#> [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 com.google.guava:guava:jar:31.1-jre with transitive dependencies
#> [INFO] ------------------------------------------------------------------------
#> [INFO] BUILD SUCCESS
#> [INFO] ------------------------------------------------------------------------
#> [INFO] Total time: 1.513 s
#> [INFO] Finished at: 2024-04-24T19:35:56+00:00
#> [INFO] Final Memory: 15M/57M
#> [INFO] ------------------------------------------------------------------------
#> /home/runner/.cache/rmaven/.m2/repository/com/google/guava/guava/31.1-jre/guava-31.1-jre.jar
fetch_artifact(coordinates = as.coordinates("org.junit.jupiter",
"junit-jupiter-api","5.9.0"))
#> /home/runner/.cache/rmaven/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.9.0/junit-jupiter-api-5.9.0.jar
# }