вівторок, 16 квітня 2013 р.

Maven assembly plugin fuck up on Spring project making

Yesterday just bumped into Maven assembly plugin issue. I tried to build one-jar project with a log of spring dependencies. It was successful, however I got error on start:
 Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: class path resource [spring-context.xml]
According to error, I tried to find issue with namespace in spring configuration files... However, it was correct and without issues. But I found spring-related files in my jar which were located in META-INF directory: spring.schemas and spring.handlers, and they have completely strange content - only several namespace, the most of namespaces were lost. So, the problem is with maven assembly plugin. Fortunately, this plugin is enough flexible and gives possibility to manage each step of building.
The correct version (doesn't perform broken merge) is:
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">

Немає коментарів:

Дописати коментар