This writes a maven repository location to a temporary settings.xml file
which persists only for the R session. The location of the maven repository
is either specified here, or can be defined by the
options("rmaven.m2.repository"=...) option. If neither of these is
provided, the location will revert to a default location within the rmaven
cache. (Approved by CRAN for a local cache location) e.g. on 'Linux' this
will default to ~/.cache/rmaven/.m2/repository/
set_repository_location(
repository_location = getOption("rmaven.m2.repository", default = .working_dir(subpath
= ".m2/repository/")),
settings_path = .settings_path()
)the expanded path of the new repository location
# Setting the repository to be a temp dir as an example:
set_repository_location(paste0(tempdir(), "/.m2/repository"))
#> /tmp/Rtmp6N3Ds7/.m2/repository
# you would never want to do this in real life as then the maven repository
# would be rebuilt on every new R session.
# set the repository location to the usual location for Java development
# set_repository_location("~/.m2/repository")
# We don't run this above example as it creates an empty directory in the
# userspace and doing so in an example violates CRAN principles.
# set the repository location back to the CRAN approved default location
set_repository_location()
#> /home/runner/.cache/rmaven/.m2/repository