MavenExists()

edit

Checks whether a Maven artifact is present in Lucee's local maven cache directory.

This is a cheap filesystem-only predicate — it does not contact any remote repository and does not resolve transitive dependencies.

Useful as a quick check or audit, or before calling MavenLoad() or MavenInfo() to avoid re-resolving an artifact that is already available locally.

Accepts either three separate arguments (groupId, artifactId, version) or a single gradle-style coordinate string ("group:artifact" or "group:artifact:version"). If the version is omitted, returns true when any version of the coord is cached locally.

Introduced: 7.1.0.98

MavenExists( groupId=string, artifactId=string, version=string );

Returns: Boolean

Argument Description
groupId
string, required
edit

The Maven group identifier, or a gradle-style coordinate string "group:artifact" / "group:artifact:version" when passed as the only argument.

artifactId
string, optional
edit

The Maven artifact identifier. Omit when passing a gradle-style coordinate as the first argument.

version
string, optional
edit

The specific version to check for. If omitted, the function returns true when any cached version of the coord is present.

Examples

edit

Gradle-style coordinate, specific version:

mavenExists( "org.apache.poi:poi-ooxml:5.2.5" );

Three-argument form:

mavenExists( "org.apache.poi", "poi-ooxml", "5.2.5" );

Any version of the coord is cached:

mavenExists( "org.apache.poi:poi-ooxml" );
// or
mavenExists( "org.apache.poi", "poi-ooxml" );

See also