Maven Shade插件的Spring 3 NamespaceHandler问题 [英] Spring 3 NamespaceHandler issues with Maven Shade plugin

查看:113
本文介绍了Maven Shade插件的Spring 3 NamespaceHandler问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Apache Maven 3.0.3和Maven Shade插件1.6的Spring 3.1.1.RELEASE.

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

使用mvn shade插件将工件包装在uber-jar中,包括其依赖项:

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>

似乎可以打包,但是在执行时会抱怨Spring NamespaceHandler问题:

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]

这同时适用于util和p命名空间,但希望它不仅限于这些:

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.

推荐答案

尝试添加

Try adding an AppendingTransformer to your config. The example specifically mentions this as being useful for Spring handlers.

这篇关于Maven Shade插件的Spring 3 NamespaceHandler问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆