I want to create a zip file containing the jar files and some resource files. But I have some problems to tell the assembly plugin to take files from a source folder and to put it into a target folder without retaining the sources folder structure.
In detail: My files are placed in ../target/lib and they should be zipped to ../app/lib. This is an extract from my xml file which should do that job:
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>app/lib</outputDirectory>
<includes>
<include>target/lib/*.*</include>
</includes>
</fileSet>
But what happens is: The files are placed to ../app/lib/target/lib/
How can I tell the maven-assembly-plugin to omit the source file structure and just take the files?
Defines the rules for matching and working with files in a given base directory.
The Assembly Plugin for Maven enables developers to combine project output into a single distributable archive that also contains dependencies, modules, site documentation, and other files. Your project can easily build distribution "assemblies" using one of the prefabricated assembly descriptors.
So in order for you to customize the way the Assembly Plugin creates your assemblies, you need to know how to use the Assembly Descriptor. This descriptor specifies the type of assembly archive to create, the contents of the assembly, and the ways in which dependencies or its modules are bundled with an assembly.
tarLongFileMode: Sets the TarArchiver behavior on file paths with more than 100 characters length. Valid values are: "warn" (default), "fail", "truncate", "gnu", "posix", "posix_warn" or "omit".
Directory must point to the folder of which all paths (both files and directories) must be copied. So you should do this:
<fileSet>
<directory>${project.basedir}/target/lib</directory>
<outputDirectory>app/lib</outputDirectory>
<includes>
<include>*.*</include>
</includes>
</fileSet>
Managed to fix it by setting the "directory" parameter to the source path and removing the source path information from "include":
<fileSet>
<directory>${project.basedir}/target/lib/</directory>
<outputDirectory>app/lib</outputDirectory>
<includes>
<include>*.*</include>
</includes>
</fileSet>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With