Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
While trying to build an old version of Apache CXF 2.2.2, I kept getting an error produced by an
XmlAppendingTransformer
used by the
maven-shade-plugin
: unable to connect to get the DTD for
http://java.sun.com/dtd/properties.dtd
(referenced by the file
META-INF/cxf/extensions.xml
)
I have tried to fix this problem by using the
ignoreDtd
option provided by maven-shade-plugin starting with version 1.3.1.
But now I am getting another more weird error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:1.3.1:shade (default) on project cxf-bundle: Execution default of goal org.apache.maven.plugins:maven-shade-plugin:1.3.1:shade failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-shade-plugin:1.3.1:shade: java.lang.AbstractMethodError: null
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-shade-plugin:1.3.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/postese/.m2/repository/org/apache/maven/plugins/maven-shade-plugin/1.3.1/maven-shade-plugin-1.3.1.jar
[ERROR] urls[1] = file:/C:/Users/postese/libraries/apache-cxf-2.2.2-patched-src/buildtools/target/cxf-buildtools-2.2.2.jar
[ERROR] urls[2] = file:/C:/Users/postese/.m2/repository/pmd/pmd/4.2/pmd-4.2.jar
[ERROR] urls[3] = file:/C:/Users/postese/.m2/repository/ant/ant/1.6/ant-1.6.jar
[ERROR] urls[4] = file:/C:/Users/postese/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[5] = file:/C:/Users/postese/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.jar
[ERROR] urls[6] = file:/C:/Users/postese/.m2/repository/asm/asm/3.2/asm-3.2.jar
[ERROR] urls[7] = file:/C:/Users/postese/.m2/repository/asm/asm-commons/3.2/asm-commons-3.2.jar
[ERROR] urls[8] = file:/C:/Users/postese/.m2/repository/asm/asm-tree/3.2/asm-tree-3.2.jar
[ERROR] urls[9] = file:/C:/Users/postese/.m2/repository/org/jdom/jdom/1.1/jdom-1.1.jar
[ERROR] urls[10] = file:/C:/Users/postese/.m2/repository/org/apache/maven/shared/maven-dependency-tree/1.1/maven-dependency-tree-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[project>org.apache.cxf:cxf-bundle:2.2.2, parent: ClassRealm[maven.api, parent: null]]]
[ERROR]
[ERROR] -----------------------------------------------------
Which library or plugin is causing the "API incompatibility" ?
–
–
After a lot of digging and trying to eliminate one-by-one the ResourceTransformers used by the maven-shade-plugin, I have found the culprit:
Apparently now the problem was not caused by the XmlAppendingTransformer, but there are two ResourceTransformers defined by Apache CXF:
apache-cxf-2.2.2-patched-src\buildtools\src\main\java\org\apache\cxf\maven:
CXFAllTransformer.java
PluginTransformer.java
The two transformers as they were defined in CXF 2.2.2 are not compatible with the new ResourceTransformer interface defined in maven-shade-plugin version 1.3.1, because this new method is missing:
public void processResource(String resource, InputStream is, List relocators) throws IOException {
They have been "fixed" in CXF 2.2.12, where they include this method.
So my "fix" was to copy the source code of these 2 transformers from the source code of CXF 2.2.12 into the "patched" source code of CXF 2.2.2.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.