RingJavafor Ring

Maven packages

Most of the Java world is on Maven Central.

Most of the Java world is on Maven Central. jMaven finds a package and everything it needs, downloads the jars to a cache and adds them to the class path.

Ring
load "java.ring"
jMaven("org.apache.commons:commons-lang3:3.14.0")
? jStatic("org.apache.commons.lang3.StringUtils","capitalize",["ring"])      # Ring
FunctionMeaning
jMaven(cCoords)resolve, download, add to the class path; gives the list of jars (the artifact first)
jMavenClasses(cCoords,aPackages)jMaven and the Ring classes of the packages (all the packages of the jar when the list is empty)
jMavenRepository(cUrl)another repository (an https:// address or a folder); it is tried first
jMavenOnlyMyRepositories()do not use Maven Central
jMavenCache(cFolder)where the jars are kept (default ~/.ringjava/maven)
jMavenOffline(true)use the cache only
jMavenVerbose(false)no message for a download
jGenerateClasses(aJars,aPackages,cFolder)the Ring classes of the packages of some jars, into a folder (kept when it has classindex.txt)

The coordinates are group:artifact:version; group:artifact gives the latest release (from maven-metadata.xml), group:artifact:version:classifier takes a classifier jar.

What the resolver does#

Artifacts of the repository that have no jar (a pom package, a BOM) are skipped. jMavenOffline(true) gives an error that names the missing file when the cache does not have it.

Ring classes of a package#

Ring
jMavenClasses("org.apache.commons:commons-lang3:3.14.0",["org.apache.commons.lang3"])
using {
	"org.apache.commons.lang3"
}
oUtils = new StringUtils
? oUtils.center(["Ring",11,"*"])

The generator runs once in a new JVM and writes the files to <cache>/generated/<group>/<artifact>/<version>/. Without the Ring classes the dynamic API (jNew, jStatic, jCall) works with every class of the jar.

Your own jars#

jClasspath("my.jar") adds a jar or a folder of jars. jGenerateClasses(["my.jar"],["com.mycompany.tools"],"myclasses/") makes the Ring classes.

Tests#

t12_maven.ring resolves from a repository in a folder (tests/data/mavenrepo: a parent POM, a BOM, a range, an exclusion, an optional and a test dependency, an OS profile, a wrong SHA-1), so it needs no network.

t24_maven_central.ring and t27_maven_central2.ring use twenty real packages of Maven Central (see Maven packages tried).

RingJava - use Java classes and methods from Ring programs.