Creating an additional attached jar artifact from the project with maven-jar-plugin

I need to create 2 jars for my module - although it is not considered to be a "good practice", this is a client request.
One jar with some api classes and the default one with the rest of the classes.
I tried to configure it using maven-jar-plugin using example from</meta> </meta> </meta> </meta>

so my plugin configuration looks like this:


The result is that the default jar comes out as expected, and the stub jar comes out without classes at all.
In the debug log i can see that the exclude parameter is not initialized when creating the stub jar, so include and exclude are equal-> results with no classes.. I tried putting empty <exclude>, it didn’t help.

If I configure these 2 jars as 2 executions of maven-jar-plugin, the default jars “ignores” include/exclude configuration and just includes everything under target/classes, and the stub jars comes out ok.

Am I missing something here?..

(Do the same thing with antrun plugin and then attach the artifact is my last option..


DevOps Architect

DevOps Group