maven 打包时spring.handlers spring.schemas被覆盖问题

有两种方式

第一是修改maven pom 文件增加

 

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.1</version>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>shade</goal>
                </goals>
                <configuration>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">  
                                <resource>META-INF/spring.handlers</resource>  
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">  
                                <resource>META-INF/spring.schemas</resource>  
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">  
                                <resource>META-INF/spring.tooling</resource>  
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.zufangbao.renterremind.Main</mainClass>
                            </transformer>
                        </transformers>
                </configuration>
            </execution>
        </executions>
      </plugin>

 

第二种方式,在已生成的jar包META-INF文件夹中增加三个文件即可

spring.handlers,spring.schemas,spring.tooling

spring.handlers:

http\://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler
http\://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler
http\://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler
http\://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler
http\://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler
http\://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler
http\://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler
http\://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler
http\://www.springframework.org/schema/jdbc=org.springframework.jdbc.config.JdbcNamespaceHandler
http\://www.springframework.org/schema/oxm=org.springframework.oxm.config.OxmNamespaceHandler
http\://www.springframework.org/schema/webflow-config=org.springframework.webflow.config.WebFlowConfigNamespaceHandler
http\://www.springframework.org/schema/mvc=org.springframework.web.servlet.config.MvcNamespaceHandler

spring.schemas:

http\://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd
http\://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd
http\://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd
http\://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd
http\://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd
http\://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd
http\://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd
http\://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.0.xsd
http\://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd
http\://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd
http\://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd
http\://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd
http\://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd
http\://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd
http\://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd
http\://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd
http\://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd
http\://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd
http\://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd
http\://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd
http\://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd
http\://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd
http\://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.0.xsd
http\://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd
http\://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd
http\://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd
http\://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd
http\://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd
http\://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd
http\://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd
http\://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd
http\://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd
http\://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd
http\://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd
http\://www.springframework.org/schema/jdbc/spring-jdbc.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd
http\://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd=org/springframework/oxm/config/spring-oxm-3.0.xsd
http\://www.springframework.org/schema/oxm/spring-oxm.xsd=org/springframework/oxm/config/spring-oxm-3.0.xsd
http\://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd=org/springframework/webflow/config/spring-webflow-config-2.0.xsd
http\://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd=org/springframework/web/servlet/config/spring-mvc-3.0.xsd
http\://www.springframework.org/schema/mvc/spring-mvc.xsd=org/springframework/web/servlet/config/spring-mvc-3.0.xsd

 

spring.tooling

# Tooling related information for the tx namespace
http\://www.springframework.org/schema/tx@name=tx Namespace
http\://www.springframework.org/schema/tx@prefix=tx
http\://www.springframework.org/schema/tx@icon=org/springframework/transaction/config/spring-tx.gif
http\://www.springframework.org/schema/aop@name=aop Namespace
http\://www.springframework.org/schema/aop@prefix=aop
http\://www.springframework.org/schema/aop@icon=org/springframework/aop/config/spring-aop.gif
http\://www.springframework.org/schema/beans@name=beans Namespace
http\://www.springframework.org/schema/beans@prefix=beans
http\://www.springframework.org/schema/beans@icon=org/springframework/beans/factory/xml/spring-beans.gif
http\://www.springframework.org/schema/util@name=util Namespace
http\://www.springframework.org/schema/util@prefix=util
http\://www.springframework.org/schema/util@icon=org/springframework/beans/factory/xml/spring-util.gif
http\://www.springframework.org/schema/context@name=context Namespace
http\://www.springframework.org/schema/context@prefix=context
http\://www.springframework.org/schema/context@icon=org/springframework/context/config/spring-context.gif
http\://www.springframework.org/schema/jee@name=jee Namespace
http\://www.springframework.org/schema/jee@prefix=jee
http\://www.springframework.org/schema/jee@icon=org/springframework/ejb/config/spring-jee.gif
http\://www.springframework.org/schema/task@name=task Namespace
http\://www.springframework.org/schema/task@prefix=task
http\://www.springframework.org/schema/task@icon=org/springframework/scheduling/config/spring-task.gif
http\://www.springframework.org/schema/lang@name=lang Namespace
http\://www.springframework.org/schema/lang@prefix=lang
http\://www.springframework.org/schema/lang@icon=org/springframework/scripting/config/spring-lang.gif
http\://www.springframework.org/schema/jdbc@name=jdbc Namespace
http\://www.springframework.org/schema/jdbc@prefix=jdbc
http\://www.springframework.org/schema/jdbc@icon=org/springframework/jdbc/config/spring-jdbc.gif
http\://www.springframework.org/schema/oxm@name=oxm Namespace
http\://www.springframework.org/schema/oxm@prefix=oxm
http\://www.springframework.org/schema/oxm@icon=org/springframework/oxm/config/spring-oxm.gif
http\://www.springframework.org/schema/mvc@name=mvc Namespace
http\://www.springframework.org/schema/mvc@prefix=mvc
http\://www.springframework.org/schema/mvc@icon=org/springframework/web/servlet/config/spring-mvc.gif

猜你喜欢

转载自jaesonchen.iteye.com/blog/2338622