maven-shade-plugin

為{幸葍}努か 提交于 2019-11-28 12:12:16

今日我们开发遇到spring的xsd文件打包的时候,丢失了,导致无法启动,

rg.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 33; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/context/spring-context-3.1.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

最后的解决方案是废弃assembly打包插件,使用shade。

原因见 http://blog.csdn.net/leonzhouwei/article/details/9978771

插件代码如下:

<plugin> 
<groupId>org.apache.maven.plugins</groupId> 
<artifactId>maven-shade-plugin</artifactId> 
<version>1.4</version> 
<executions> 
<execution> 
<phase>package</phase> 
<goals> 
<goal>shade</goal> 
</goals> 
<configuration> 

<filters> 
<filter> 
<artifact>*:*</artifact> 
<excludes> 
<exclude>META-INF/*.SF</exclude> 
<exclude>META-INF/*.DSA</exclude> 
<exclude>META-INF/*.RSA</exclude> 
</excludes> 
</filter> 
</filters> 

<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.ManifestResourceTransformer"> 
<mainClass>com.jd.payment.risk.benz.qpay.daylimt.DaylimitAmountTopology</mainClass> 
</transformer> 
<transformer 
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> 
<resource>META-INF/spring.schemas</resource> 
</transformer> 
</transformers> 
</configuration> 
</execution> 
</executions> 
</plugin>



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!