MavenExport()
Walks Lucee's local maven cache directory and returns a pom.xml string listing every cached artifact as a <dependency> entry.
The emitted pom uses a synthetic self-identifier (com.example.lucee:mvn-cache-export:0) with <packaging>pom</packaging> — it is a manifest of what is cached, not a buildable project.
Scope is not recorded on disk so no <scope> is emitted; classifier is derived from the jar filename when present (e.g. native libraries like sqlite-jdbc-3.47.0.0-linux-x86_64.jar are exported with <classifier>linux-x86_64</classifier>).
Pairs with MavenImport() to snapshot and restore a cache state. Use fileWrite( path, mavenExport() ) to persist the output.
Introduced: 7.1.0.98
MavenExport( );
Returns: String
This function does not take any arguments.
Examples
editGet the pom XML as a string:
pomXml = mavenExport();
dump( parseXml( pomXml ), true );
Write the snapshot to disk:
fileWrite( "/app/pom.xml", mavenExport() );
Snapshot after loading known-good dependencies — commit the pom, rehydrate elsewhere with MavenImport():
mavenLoad( "org.apache.poi:poi-ooxml:5.2.5" );
mavenLoad( "com.google.guava:guava:32.1.3-jre" );
fileWrite( "/app/mvn-cache.xml", mavenExport() );
Audit what's in an environment's cache (count distinct coords):
pom = xmlParse( mavenExport() );
count = arrayLen( xmlSearch( pom, "//*[ local-name()='dependency' ]" ) );
echo( "Cached deps: " & count, true );
See also
- Java
- Lucee Server related Tags, Functions and Guides
- DevOps
- MavenExists()
- MavenImport()
- MavenInfo()
- MavenLoad()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)