簡體   English   中英

Spring 3 NamespaceHandler與Maven Shade插件有關

[英]Spring 3 NamespaceHandler issues with Maven Shade plugin

Spring 3.1.1.RELEASE與Apache Maven 3.0.3和Maven Shade插件1.6。

使用mvn shade插件將工件打包在uber-jar中,包括它的依賴項:

<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問題:

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命名空間,但期望它不限於這些:

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

如果我手寫重寫屬性或列表(util),問題就會消失。

嘗試在配置中添加AppendingTransformer 該示例特別提到這對Spring處理程序很有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM