I've noticed that when using CXF as a Maven dependency and aggregating it into an uber-Jar using the Maven Shade plugin there is an issue in that by default, the META-INF/cxf/bus-extensions.txt file (and other necessary CXF resources) aren't aggregated properly and loaded properly. They are kept in separate files. For examples of this, see:

  1. Unable to render Jira issues macro, execution error.
  2. Unable to render Jira issues macro, execution error.

The fix is to use the Maven Shade Plugin's AppendingTransformer to combine all the copies of the bus-extensions.txt file present in the jars. See these examples here:

https://fisheye6.atlassian.com/browse/cxf/osgi/bundle/all/pom.xml?r=12acd46e3dbe98fa1321374b09174d5876271f08#to448

https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#AppendingTransformer

You can handle it with the plugin configuration for the Shade plugin e.g., like this:

Shade Plugin Example
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>

<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*</exclude>
<exclude>LICENSE.txt</exclude>
<exclude>NOTICE.txt</exclude>
<exclude>CHANGES</exclude>
<exclude>README</exclude>
<exclude>builddef.lst</exclude>
<!--  clutter not needed in jar  -->
<exclude>resources/grib1/nasa/README*.pdf</exclude>
<exclude>resources/grib1/**/readme*.txt</exclude>
<exclude>resources/grib2/**/readme*.txt</exclude>
<!--
 TIKA-763: Workaround to avoid including LGPL classes 
-->
<exclude>ucar/nc2/iosp/fysat/Fysat*.class</exclude>
<exclude>ucar/nc2/dataset/transform/VOceanSG1*class</exclude>
<exclude>ucar/unidata/geoloc/vertical/OceanSG*.class</exclude>
</excludes>
</filter>
</filters>


<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.apache.tika.cli.TikaCLI</mainClass>
</transformer>

<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/LICENSE</resource>
<file>target/classes/META-INF/LICENSE</file>
</transformer>

<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/NOTICE</resource>
<file>target/classes/META-INF/NOTICE</file>

</transformer>


<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/DEPENDENCIES</resource>
<file>target/classes/META-INF/DEPENDENCIES</file>

</transformer>

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/cxf/bus-extensions.txt</resource>

</transformer>
</transformers>

</configuration>
</execution>

</executions>

</plugin>
  • No labels

1 Comment

  1. Sergey Beryozkini don't have permission to edit this page.