I’m trying to write a maven assembly and I’m not sure how to continue. It’s fairly complicated, so the examples I google don’t really help. This is what I’m trying to do:
- Create an installation file using launch4j. This part works, assuming the jar file is correctly assembled (hence the need for a maven assembly.)
- The installation program contains some dependencies. These are assembled (currently) using the
jar-with-dependenciesdescriptorRef. This works as well. - I need to include a war file (from another project) into the big jar. This is my confusion.
How do I create an assembly.xml that will do both the jar with dependencies (unpacking all of those jar files) and include a war file from another project (which is not unpacked).
Any help would be appreciated.
Assuming you have a project structure similar to the one below (I’m assuming a simple structure since you didn’t mention anything particular about it):
. ├── pom.xml └── src ├── main │ ├── assembly │ │ └── uberjar.xml │ └── java │ └── com │ └── stackoverflow │ └── App.java └── test └── java └── com └── stackoverflow └── AppTest.javaWith the following pom.xml:
As you can see,
jar-with-dependenciesdescriptor here, we are going to reuse it in our own custom assembly descriptor.runtimescope so that we’ll be able to include it in the assembly.And now, the custom
uberjar.xml:This is a little variation of the
jar-with-dependenciesdescriptor that will create a jar:As shown below: