I want to create a .zip
file instead of a .jar
file when I run mvn clean package
. The .zip
file should have a directory structure as follows -
/
|- bin
|- conf
| |- All Property Files
|- lib
|- All JAR Files (packaged jar and its dependency jar OR a single fat jar)
I searched a lot but the only thing I end up getting is changing the directory structure of the main project folder and not the packaged content. I'm aware of various packaging types like JAR, WAR, EAR etc. but not sure if a .zip
file can be made.
Is it possible to make a .zip
instead of a JAR file? If so, how and can its directory structure be manipulated?
Update: Found an answer on how to create .zip
files instead. But it doesn't contain info on changing directory structure.
Update: Solved it myself. See answer below.
Had found an answer on how to create .zip
files. It seems that tweaking with the descriptor.xml
file will give me the desired result. Following is my descriptor.xml
file.
<assembly>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/lib</directory>
<outputDirectory>lib</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/resources/config</directory>
<outputDirectory>config</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/resources/bin</directory>
<outputDirectory>bin</outputDirectory>
</fileSet>
</fileSets>
</assembly>