MavenImport()

edit

Parses a pom.xml and resolves each declared <dependency> into Lucee's local maven cache, fetching any that are not already present.

By default only the literal dependencies listed in the pom are resolved — pairs symmetrically with MavenExport(), which writes the full cache contents as a flat list.

Pass includeTransitive=true to also walk the dependency tree for each entry (same behaviour as MavenLoad()).

Returns a query with the same shape as MavenInfo(), showing what was resolved.

Introduced: 7.1.0.98

MavenImport( pomPath=string, includeTransitive=boolean );

Returns: Query

Argument Description Default
pomPath
string, required
edit

Filesystem path to a pom.xml file to import.

includeTransitive
boolean, optional
edit

If false (default), only the literal <dependency> entries in the pom are resolved. If true, the full transitive dependency tree is resolved for each entry.

false

Examples

edit

Rehydrate a cache from a committed pom:

q = mavenImport( "/app/pom.xml" );
systemOutput( "Resolved " & q.recordcount & " dependencies", true );

Literal mode (default) — only the coords listed in the pom, no transitive walk — round-trips exactly against MavenExport():

fileWrite( "/tmp/pom.xml", mavenExport() );
// ... elsewhere, fresh install ...
mavenImport( "/tmp/pom.xml" );

Transitive mode — resolve each entry's full dependency tree, same as MavenLoad():

q = mavenImport( "/app/top-level-deps.xml", includeTransitive=true );

Inspect what was resolved:

q = mavenImport( "/app/pom.xml" );
loop query=q {
    systemOutput( q.groupId & ":" & q.artifactId & ":" & q.version & " -> " & q.path, true );
}

See also