You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tirumal Reddy Moolamalla <t....@zensar.com> on 2011/01/20 12:33:39 UTC

Maven Assembly Plug-in - Creating custom root folder inside TAR file

Hi,

I want to create a tar file using assembly plugin. I am able to do create a tar file but unable to customize the root folder. It always is project/module name.

For example: My module name is "Example" and I want to create "Example.tar" file and it should directly contain "MyFolder". But when I create tar file the "MyFolder" is under the "Example" folder by default.

I need something like this.
Example.tar
---------MyFolder

But I am getting like this.
Example.tar
-------Example
------------MyFolder


Below are my "bin.xml" and "pom.xml".

pom.xml
-------------------------
<plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.2</version>
      <executions>
            <execution>
                  <phase>process-resources</phase>
                  <goals>
                        <goal>single</goal>
                  </goals>
            </execution>
      </executions>
      <configuration>
            <descriptors>
                  <descriptor>${project.basedir}/src/main/assembly/bin.xml</descriptor>
            </descriptors>
      </configuration>
</plugin>

bin.xml
-----------------------
<assembly
      xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
      http://maven.apache.org/xsd/assembly-1.1.2.xsd">

      <id>bin</id>
      <formats>
            <format>tar</format>
      </formats>
      <fileSets>
            <fileSet>
                  <directory>${project.basedir}/src/main/MyFolder</directory>
                  <outputDirectory>MyFolder</outputDirectory>
            </fileSet>
      </fileSets>
</assembly>


Regards,
Tirumal Reddy M


Re: Maven Assembly Plug-in - Creating custom root folder inside TAR file

Posted by Marc Rohlfs <po...@googlemail.com>.
yes!

On 20/01/11 12:56, Tirumal Reddy Moolamalla wrote:
> I got solution to this. You just need to put<includeBaseDirectory>false</includeBaseDirectory>  in your assembly descriptor file.
>
> Regards,
> Tirumal Reddy M
>
>
> -----Original Message-----
> From: Tirumal Reddy Moolamalla [mailto:t.moolamalla@zensar.com]
> Sent: Thursday, January 20, 2011 5:04 PM
> To: users@maven.apache.org
> Subject: Maven Assembly Plug-in - Creating custom root folder inside TAR file
>
> Hi,
>
> I want to create a tar file using assembly plugin. I am able to do create a tar file but unable to customize the root folder. It always is project/module name.
>
> For example: My module name is "Example" and I want to create "Example.tar" file and it should directly contain "MyFolder". But when I create tar file the "MyFolder" is under the "Example" folder by default.
>
> I need something like this.
> Example.tar
> ---------MyFolder
>
> But I am getting like this.
> Example.tar
> -------Example
> ------------MyFolder
>
>
> Below are my "bin.xml" and "pom.xml".
>
> pom.xml
> -------------------------
> <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-assembly-plugin</artifactId>
>        <version>2.2</version>
>        <executions>
>              <execution>
>                    <phase>process-resources</phase>
>                    <goals>
>                          <goal>single</goal>
>                    </goals>
>              </execution>
>        </executions>
>        <configuration>
>              <descriptors>
>                    <descriptor>${project.basedir}/src/main/assembly/bin.xml</descriptor>
>              </descriptors>
>        </configuration>
> </plugin>
>
> bin.xml
> -----------------------
> <assembly
>        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
>        http://maven.apache.org/xsd/assembly-1.1.2.xsd">
>
>        <id>bin</id>
>        <formats>
>              <format>tar</format>
>        </formats>
>        <fileSets>
>              <fileSet>
>                    <directory>${project.basedir}/src/main/MyFolder</directory>
>                    <outputDirectory>MyFolder</outputDirectory>
>              </fileSet>
>        </fileSets>
> </assembly>
>
>
> Regards,
> Tirumal Reddy M
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Maven Assembly Plug-in - Creating custom root folder inside TAR file

Posted by Tirumal Reddy Moolamalla <t....@zensar.com>.
I got solution to this. You just need to put <includeBaseDirectory>false</includeBaseDirectory> in your assembly descriptor file.

Regards,
Tirumal Reddy M


-----Original Message-----
From: Tirumal Reddy Moolamalla [mailto:t.moolamalla@zensar.com] 
Sent: Thursday, January 20, 2011 5:04 PM
To: users@maven.apache.org
Subject: Maven Assembly Plug-in - Creating custom root folder inside TAR file

Hi,

I want to create a tar file using assembly plugin. I am able to do create a tar file but unable to customize the root folder. It always is project/module name.

For example: My module name is "Example" and I want to create "Example.tar" file and it should directly contain "MyFolder". But when I create tar file the "MyFolder" is under the "Example" folder by default.

I need something like this.
Example.tar
---------MyFolder

But I am getting like this.
Example.tar
-------Example
------------MyFolder


Below are my "bin.xml" and "pom.xml".

pom.xml
-------------------------
<plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.2</version>
      <executions>
            <execution>
                  <phase>process-resources</phase>
                  <goals>
                        <goal>single</goal>
                  </goals>
            </execution>
      </executions>
      <configuration>
            <descriptors>
                  <descriptor>${project.basedir}/src/main/assembly/bin.xml</descriptor>
            </descriptors>
      </configuration>
</plugin>

bin.xml
-----------------------
<assembly
      xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
      http://maven.apache.org/xsd/assembly-1.1.2.xsd">

      <id>bin</id>
      <formats>
            <format>tar</format>
      </formats>
      <fileSets>
            <fileSet>
                  <directory>${project.basedir}/src/main/MyFolder</directory>
                  <outputDirectory>MyFolder</outputDirectory>
            </fileSet>
      </fileSets>
</assembly>


Regards,
Tirumal Reddy M


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven Assembly Plug-in - Creating custom root folder inside TAR file

Posted by Marc Rohlfs <po...@googlemail.com>.
Simply add '<includeBaseDirectory>false</includeBaseDirectory>' to Your 
'bin.xml'. (See 
http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_assembly)


On 20/01/11 12:33, Tirumal Reddy Moolamalla wrote:
> I need something like this.
> Example.tar
> ---------MyFolder
>
> But I am getting like this.
> Example.tar
> -------Example
> ------------MyFolder
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org