• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Maven assembly descriptor question

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 [http://www.springframework.org/schema/p])

http://jira.codehaus.org/browse/MASSEMBLY-360

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

Thanks
 
Emilio Kazwell
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Emilio Kazwell
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies

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)

<exclude>META-INF/spring.handlers</exclude>
<exclude>META-INF/spring.schemas</exclude>

- 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!

ap

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic