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 http://maven.apache.org/plugins/maven-jar-plugin/usage.html</meta> </meta> </meta> </meta>

so my plugin configuration looks like this:

          <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>com/xxx/yyy/zzz/**/*</include>
                    </includes>
                    <excludes>
                        <exclude>com/xxx/yyy/zzz/**/*StubImpl.class</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>stub-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>stub</classifier>
                            <includes>
                                <include>com/xxx/yyy/zzz/**/*StubImpl.class</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
          </plugin>

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