Skip to main content

Class Path Dependencies for expansion-resources

If your expansion-resource requires libraries to be available on the class-path when expanding, there is an option to define the resources in the expansionResource.xml.

First, add the dependencies to your pom.xml file:

<dependencies>
<dependency>
<groupId>some.group</groupId>
<artifactId>my-lib</artifactId>
<version>3.2.1</version>
</dependency>
</dependencies>

Any dependencies with scope test or provided will be ignored.

Next, enable the option includeClassPathDependencies on the expanders-maven-plugin:

  <plugin>
<groupId>net.democritus.maven.plugins</groupId>
<artifactId>expanders-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>expansionResource</goal>
</goals>
<configuration>
<rootDirectory>${basedir}/main</rootDirectory>
<includeClassPathDependencies>true</includeClassPathDependencies>
</configuration>
</execution>
</executions>
</plugin>

After the build, the expansionResource.xml should now contain the ClassPathDependency for your library:

<expansionResource name="org.normalizedsystems.moo:my-expanders">
<!-- ... -->
<classPathDependencys>
<classPathDependency>
<group>my.group</group>
<artifact>my-lib</artifact>
<version>3.2.1</version>
</classPathDependency>
</classPathDependencys>
</expansionResource>

During expansion, these ClassPathDependencies will be resolved and added to the class-path.

note

If multiple expansion-resources reference different versions of the same artifact, only the newest version will be resolved.

Metamodel projects

For metamodel projects, the metamodel-stack version 4.6.0 introduces the option meta.packaging.useClassPathDependencies. If you put this option on the ApplicationInstance, it will replace the fat jar assembly build with a slim jar with ClassPathDependencies.