I try to use maven-shade-plugin
for a modular jar:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>javax.xml.bind:jaxb-api</include>
<include>com.sun.xml.bind:jaxb-impl</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>javax.xml.bind</pattern>
<shadedPattern>org.update4j.javax.xml.bind</shadedPattern>
</relocation>
<relocation>
<pattern>com.sun.xml.bind</pattern>
<shadedPattern>org.update4j.com.sun.xml.bind</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
But Maven will remove my module-info.class
from the shaded jar, with a warning:
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
How can I configure it to leave it?
EDIT: the warning actually happens when it removes the shaded jar's module descriptor, not my own.