File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven assembly descriptor question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven assembly descriptor question" Watch "Maven assembly descriptor question" New topic

Maven assembly descriptor question

Emilio Kazwell
Ranch Hand

Joined: Aug 28, 2009
Posts: 37
I'm currently dealing with the spring.handlers/spring.schemas problem described in the following defect

(quickly: maven jar-with-dependencies plugin is overwriting files with the same name from different jars, so that the last it adds wins. This means that when using spring dependencies some spring.handlers and spring.schemas files end up missing and you will get a runtime error such as "Configuration problem: Unalbe to locate Spring NamespaceHandler for XML schema namespace [])

You can see that the second to bottom comment has a work around listed that I would like to use but I'm not sure how exactly to go about altering the assembly descriptor for a pre-defined assembly (jar-with-dependencies in this case) or if I can some how just add the specified exclusions to the plugin config in my pom.xml file

Emilio Kazwell
Ranch Hand

Joined: Aug 28, 2009
Posts: 37
No thoughts? I'm reading a Maven book right now and the section on the assembly descriptor is about 35 pages and pretty abstruse. I'm unable to determine if my answer is even in there.
Perhaps that's why I've no responses.
Anadi Misra
Ranch Hand

Joined: Jun 03, 2008
Posts: 69
Ok, I am not sure but you might be looking for something like this .... defining your own dependency set in the POM helps; that ways you explicitly provide the dependencies that you want; something like this

This is an example from a module we have which is used as a tool for injecting XMLs to our CMS; and it needs a lot of external and internal jars and war files during runtime. Another way can be to mention the dependencies in the assembly descriptor under the dependency set section.

Anadi Mishra.
Emilio Kazwell
Ranch Hand

Joined: Aug 28, 2009
Posts: 37
Received an answer. Thanks.

Hi Emilio

From what I know, you can't "tweak" a pre-defined descriptor such as jar-with-dependencies, so you'll need to make your own assembly. The definition of jar-with-descriptors, if you want to use that as a base, is here:

To recap what we did in our project:
- manually locate the spring.handlers and spring.schemas files from all the Spring dependencies you're including in your project
- merge these to create two files, spring.handlers and spring.schemas, and place them in src/main/resources/META-INF
- exclude all the spring.handlers and spring.schemas *that come from JARs* using the code snippet from the JIRA issue in the assembly descriptor (this is the key bit)


- your merged spring.handlers and spring.schemas files will automatically be included in the resulting JAR since you have them on the build path, in src/main/resources

Good luck!

I agree. Here's the link:
subject: Maven assembly descriptor question
It's not a secret anymore!