build_classpath: Get a java classpath from dependency list

Description Usage Arguments On Specifying Dependencies Build or Augment a Classpath Classpath From a pom.xml

View source: R/build_classpath.R

Description

Given one or more dependencies retrieve a classpath that can be used to set up rJava correctly.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
build_classpath(
  artifacts,
  pom_path,
  pkg_name,
  dep_plugin_version,
  include_scope = "runtime",
  local_repo,
  absolute_paths = TRUE,
  overwrite_if_newer = TRUE,
  overwrite_releases = FALSE,
  overwrite_snapshots = FALSE,
  mvn_args,
  verbose = FALSE
)

augment_classpath(
  artifacts,
  pom_path,
  pkg_name,
  pom_name = "pom.xml",
  verbose = FALSE,
  ...
)

build_classpath_from_pom(
  pom_path,
  include_scope = "runtime",
  absolute_paths = TRUE,
  overwrite_if_newer = TRUE,
  overwrite_releases = FALSE,
  overwrite_snapshots = FALSE,
  dep_plugin_version,
  mvn_args,
  local_repo,
  verbose = FALSE
)

Arguments

artifacts

Character vector. Should be of the form 'groupId:artifactId:version[:packaging[:classifier]]' where the packaging and classifier inputs are optional.

pom_path

Character. Path to a pom.xml to build a classpath from.

pkg_name

Character. Name of a package that has a pom.xml in the inst/java directory. In this case a pom_path may be omitted and the pom will be discovered in the specified package.

dep_plugin_version

Character. The version of the maven dependency plugin. See https://github.com/apache/maven-dependency-plugin/releases for release versions. If nothing is provided then a default version is chosen (may change over time with releases of this package).

include_scope

Character. Scope to include. An Empty string indicates all scopes. Possible scopes are c("runtime", "compile", "test", "provided", "system").

local_repo

Character. Path to local maven repository. If missing then the default location or the location specified in a user's settings.xml will be used.

absolute_paths

Logical. Output absolute filename for resolved artifacts.

overwrite_if_newer

Logical. If TRUE overwrite artifacts that don't exist or are older than the source.

overwrite_releases

Logical. If TRUE overwrite release artifacts.

overwrite_snapshots

Logical. If TRUE overwrite snapshot artifacts.

mvn_args

Character vector. Additional arguments to pass to the Maven dependency:build-classpath plugin. Should be of the form c("-Dparam1=value1", "-Dparam2=value2").

verbose

Logical. Dump maven output to console.

...

Arguments passed to .jinit

On Specifying Dependencies

Resolve the java classpath from either a vector of dependencies or a pom.xml. Maven will attempt to download any dependencies (direct or transitive) that are not found in the local maven repository.

The deps, pom_path, and pkgname inputs are mutually exclusive. Use exactly one or an error will result.

Build or Augment a Classpath

build_classpath will return a character vector of jars to be added to the classpath but will not actually change the classpath. augment_classpath will update the java classpath (and initilize the JVM if necessary).

There are several parameters available for the Maven dependency:build-classpath plugin. See https://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html for details. Only the parameters likely to be of most use in the context of resolving a java classpath for use from R are directly exposed. Any custom parameters beyond these can be entered via the mvn_args input.

Classpath From a pom.xml

This function requires a simple pom.xml to function, so its usability is limited. However it can be very handy for packages with java dependencies where there is not a fat jar to depend upon. If you have a list of dependencies but no actual pom.xml, see build_classpath


mitre/mvndeps documentation built on Feb. 18, 2020, 6:13 p.m.