You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Vinayak Samak <vs...@gmail.com> on 2013/11/13 15:54:05 UTC

Query Regarding assembly plugin

Hi,

I wanted to create zip out of directory. For that I am using
maven-assembly-plugin.
It looks like this :

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptor>installer-assembly.xml</descriptor>
<finalName>test</finalName>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

My installer-assembly.xml looks like :
<assembly>
        <id>bin</id>
        <formats>
                <format>zip</format>
        </formats>
        <fileSets>
                <fileSet>
                        <directory>release/</directory>
                        <outputDirectory>/</outputDirectory>
<includes>
                                <include>**/*</include>
                        </includes>
                        <excludes>
                                <exclude>**/spec/</exclude>
                        </excludes>
                <fileMode>0770</fileMode>
                </fileSet>
        </fileSets>
</assembly>


It creates test.zip for me.
But when I unzip this "test.zip" into directory "dir", I get structure like
:
dir
|-test
     |-different files

Query here is, is there any way to create a zip in such a way that, I will
get following structure :
dir
|-different file

Means it wont create folder name with test and then zip it with name
test.zip.
Instead of that, I want to zip content of folder with file name test.zip.

Any kind of help will be appreciated.




-- 


*Thanks*


*Vinayak S. Samak*

*Please don't print this Email unless you really need to. This will
preserve trees on planet earth.*


*Save Electricity, Water & Paper!! Go green for better tomorrow :)*

*[image: See full size image]*

Re: Query Regarding assembly plugin

Posted by Anders Hammar <an...@hammar.net>.
Set includeBaseDirectory to true in the assembly descriptor [1].

/Anders

[1] http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html


On Wed, Nov 13, 2013 at 3:54 PM, Vinayak Samak <vs...@gmail.com> wrote:

> Hi,
>
> I wanted to create zip out of directory. For that I am using
> maven-assembly-plugin.
> It looks like this :
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
>  <artifactId>maven-assembly-plugin</artifactId>
> <configuration>
> <appendAssemblyId>false</appendAssemblyId>
>  <descriptor>installer-assembly.xml</descriptor>
> <finalName>test</finalName>
>  </configuration>
> <executions>
> <execution>
>  <phase>package</phase>
> <goals>
> <goal>single</goal>
>  </goals>
> </execution>
> </executions>
> </plugin>
>
> My installer-assembly.xml looks like :
> <assembly>
>         <id>bin</id>
>         <formats>
>                 <format>zip</format>
>         </formats>
>         <fileSets>
>                 <fileSet>
>                         <directory>release/</directory>
>                         <outputDirectory>/</outputDirectory>
>  <includes>
>                                 <include>**/*</include>
>                         </includes>
>                         <excludes>
>                                 <exclude>**/spec/</exclude>
>                         </excludes>
>                 <fileMode>0770</fileMode>
>                 </fileSet>
>         </fileSets>
> </assembly>
>
>
> It creates test.zip for me.
> But when I unzip this "test.zip" into directory "dir", I get structure
> like :
> dir
> |-test
>      |-different files
>
> Query here is, is there any way to create a zip in such a way that, I will
> get following structure :
> dir
> |-different file
>
> Means it wont create folder name with test and then zip it with name
> test.zip.
> Instead of that, I want to zip content of folder with file name test.zip.
>
> Any kind of help will be appreciated.
>
>
>
>
> --
>
>
> *Thanks *
>
>
> *Vinayak S. Samak *
>
> *Please don't print this Email unless you really need to. This will
> preserve trees on planet earth.*
>
>
> *Save Electricity, Water & Paper!! Go green for better tomorrow :)*
>
> *[image: See full size image]*
>
>
>