Spring 3 NamespaceHandler issues with Maven Shade plugin
maven, maven-3, maven-shade-plugin, spring, spring-3
Solution
Try adding an AppendingTransformer to your config. The example specifically mentions this as being useful for Spring handlers.
Problem
Spring 3.1.1.RELEASE with Apache Maven 3.0.3 and Maven Shade plugin 1.6. Using the mvn shade plugin to package the artifact in an uber-jar, including its dependencies: ``` <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>1.6</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.MyApplication</mainClass> </transformer> </transformers> </configuration> </execution> </executions> ``` Seems to package just fine but on execution complains of Spring NamespaceHandler issues: ``` Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/util] Offending resource: class path resource [spring/test-context.xml] ``` This applies to both the util and p-namespaces, but expect it's not limited to these: ``` xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" ``` If I rewrite the property or list (util) longhand the issues disappear.