Skip to content

Using custom packaging type as dependency in maven

I have created a custom packaging type in my maven plugin so that I can deploy files in this custom format.

E.g. I have a project that uses this format for packaging. The pom.xml has:

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

I am able to deploy successfully to a repository. But now I want to use this as a dependency in another project.

E.g. by adding something like this:


This is working fine, also except that mybin format includes some nested resources such as jar files) that I would like to include in the classpath.

I so far I’ve attempted to programmatically extract the jars from inside a mojo and programmatically add it to the project using project.getModel().addDependency(systemJarDep), but this doesn’t seem to be picked up by the compiler.

How can this be done in Maven?


It seems that this sort of thing cannot be done in Maven.

I am solving my problem by adjusting the format of my custom package type to be a jar file itself, with all of the classes that I want on the classpath directly inside it. The other sub-resources that I don’t require on the classpath (at least by default) are bundled inside the META-INF directory.

This is not ideal, but it is an acceptable solution for now.