I’m currently working on a project which requires the build to produce a zip archive of the jar and some other stuff (doc files mainly). I’ve used the maven assembly plugin, with an assembly descriptor to help me out here. However, there was one slightly unusual requirement – I needed to change the name of the jar so that inside the zip, it has a non-standard name, and no version number (the reasons behind this are fairly weak, but basically it’s because a load of other scripts, which we can’t change, expect to find the jar in this non-standard format).
So, the build produces:
but in the zip I need to have:
Here’s how I did it.
- Include the maven-assembly plugin in the build:
- Create the kit.xml in src/main/assembly and specify <destName> in the file inclusion. Here’s my kit.xml:
As you can see, the assembly descriptor has a “files” section, which is what does the trick for us. I’ve isolated the actual section below for clarity:
Very useful link, but i’ve tried something similar and it creates two files, myfile.war, with all the default options, and myfile-permissions.war, with renamed files (that takes from the first one) and so on.
“permissions” as “kit” in your example, is stored in kit and is appended to our project name for the secondary .war or .zip. I cannot leave it empty…do you know a way for renaming files inside the “primary” war or zip that is created?
I have to say that this information is awesome. I am extremely awed to uncover such useful guides on adjustable piano bench.
Thank you — saved my bacon
Wow, that’s what I was looking for, what a stuff! existing here at this blog, thanks admin of this web page.
Hi would you mind sharing which blog platform you’re working with? I’m looking to
start my own blog soon but I’m having a tough time selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something unique.
P.S Sorry for being off-topic but I had to ask!
Here is my solution via outputFileNameMapping using dependency sets with war files
Thanks Gede great input. I think that those things are imarptont (live reloading of settings etc) but should not be designed in from the outset (but then I’m an emergent design guy). Frameworks like OSGi are compelling, but charge a very high complexity tax. Allowing for fast (and automated) rolling restarts including re-deployment of externalised settings is most imarptont and as you say this requires redundancy and a simple architecture.
Thank you ! Thats exactly what I am searching fory!
Thank for this solution, have you an idea on how modify files contents using maven assembly plugin?