Spring 3 Handler Namespace with Maven Shade Plugin

Spring 3.1.1.RELEASE with Apache Maven 3.0.3 and the Maven Shade 1.6 plugin.

Using the mvn shade plugin to package an artifact in 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> 

The package seems to be just fine, but when making complaints about Spring, there are problems with the Handler namespace:

 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 util and p-namespaces, but expect that they are not limited to them:

 xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" 

If I rewrote a property or list (util) of longhand, the problems go away.

+7
source share
1 answer

Try adding AppendingTransformer to your configuration. In this example, it is referred to as useful for Spring handlers.

+17
source

All Articles