4

I need to untar a arbitrary tar.gz file(not an artifact) using maven. I used following plugin, but it untar all the content of the tar.gz file in some other .tar file. I need to get all the content to a specific folder rather than to some other tar file. Please suggest what else can I do.

Here is my pom.xml module:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>  
    <artifactId>maven-antrun-plugin</artifactId>  
    <version>1.6</version>  
    <executions>  
        <execution>  
            <id>prepare</id>  
            <phase>validate</phase>  
            <configuration>  
                <tasks>  
                    <echo message="prepare phase" />  
                    <gunzip src="../gui/src/CelGui/target/cel-gui.tar.gz"/>  
                </tasks>  
            </configuration>  
            <goals>  
                <goal>run</goal>  
            </goals>  
        </execution>  
    </executions>  
</plugin>  
sakshi garg
  • 141
  • 1
  • 7
  • 1
    Possible duplicate of [How to untargz files using maven?](http://stackoverflow.com/questions/14519146/how-to-untargz-files-using-maven) – Tunaki Nov 16 '15 at 09:57
  • @Tunkai .. Sir I have gone through all the solutions but none solved my issue. To me, maven-antrun-plugin is not working. – sakshi garg Nov 16 '15 at 10:01
  • 1
    If `maven-antrun-plugin` is not working then you should post what you tried and what didn't work. Because it should (as per the accepted answer on the dupe). – Tunaki Nov 16 '15 at 10:02
  • [ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (prepare) on project tools: An Ant BuildException has occured: Error while expanding C:\Users\esakgar\Document\cel\gui\src\CelGui\target\cel-gui.tar.gz [ERROR] java.io.IOException: unexpected EOF with 1024 bytes unread – sakshi garg Nov 16 '15 at 10:04
  • Please edit your question with your POM, and full error message. – Tunaki Nov 16 '15 at 10:04

1 Answers1

5

Use untar command after gunzip that will complete the task for you.

<untar src="xyz.tar.gz" compression="gzip" dest="<desitination_folder>"/>

after this delete your tar file if required using delete command

Axel Fontaine
  • 34,542
  • 16
  • 106
  • 137
Vibha Singh
  • 61
  • 1
  • 4