Create a ZIP archive with Maven

I followed the answer on how to create a zip archive in Maven here: https://stackoverflow.com/a/416829/ and you have a few of the following questions:

ZIP content for directory exclusion:

As in the example, I:

<fileSet> <directory>${project.basedir}/src/export</directory> <useDefaultExcludes>true</useDefaultExcludes> </fileSet> 

In zip I get

 src export Dir1 Dir2 

but i only want

 Dir1 Dir2 

in zip. Is it possible?

Output file name

The output file name is created with the extension .zip. Is it possible in Maven to redefine the extension to something else (say .abc)?

+6
source share
2 answers

The outputDirectory parameter can be used to change the directory in the assembly to which the files are output: this should do what you need:

 <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> <id>bin</id> <formats> <format>zip</format> </formats> <fileSets> <fileSet> <directory>${project.basedir}/ScriptedBuild/rConnect/extract/</directory> <useDefaultExcludes>true</useDefaultExcludes> <outputDirectory>/</outputDirectory> </fileSet> </fileSets> </assembly> 
+13
source
+1
source

Source: https://habr.com/ru/post/915750/


All Articles