0

I am struggling to extract contents of nested zip file in an artifact.

Artifact has below content zipped: 

Base_Config.zip
       First_Pack.zip
             01_first.json
             02_second.json
       Second_Pack.zip
             01_third.json
             02_fourth.json

able to extract only zip files under Base_config.zip not it's contents *.json
`<plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.10</version>
            <executions>
                <execution>
                    <id>unpack</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>com.shashank.bss.XXX</groupId>
                                <artifactId>testdatagen</artifactId>
                                <version>24.5.0</version>
                                <type>zip</type>
                            </artifactItem>
                        </artifactItems>
                        <outputDirectory>target/assemble/shashank/deps</outputDirectory>
                        <includes>testdatagen-*-First_Pack.zip</includes>
                    </configuration>
                </execution>

`

Tried multiple solution: Failed to get content using assembly descriptor,

Tried solution available on this as well: Custom maven assembly

Not want to use deprecated plugin and the solution available there with plugin: truezip-maven-plugin Unpack inner zips in zip with Maven

Is it possible to get the work done by this plugin: maven-dependency-plugin & unpack.

Or any other simple solution available from maven?

Community
  • 1
  • 1
Shashank
  • 63
  • 6
  • What would be the expected directory structure? – Tunaki Oct 31 '16 at 10:32
  • Hi Tunaki, target/assemble/shashank/deps Wanted few json files to be extracted in this directory. – Shashank Oct 31 '16 at 10:40
  • @shashank makkar you commented about truezip-maven-plugin but put a link related to maven-antrun-plugin. I am not sure maven-antrun-plugin is deprecated, and it does the work, so ... – alainlompo Oct 31 '16 at 17:05
  • @alainlompo Actually i mentioned both. Ant plugin which has been deprecated & truezip-maven-plugin solution (that was in comments by @palacsint) I tried with Ant plugin, it did not worked out. Can you share the way i can achieve: to download the artifact from a different project which has nested zip as described and extract inner-most json – Shashank Oct 31 '16 at 17:39
  • Possible ducplicate of http://stackoverflow.com/questions/3264064/unpack-inner-zips-in-zip-with-maven – Linuslabo Nov 02 '16 at 17:37
  • @Linuslabo Problem statement is same and I have highlighted this link in my problem statement as well Solution available there is using ant plugin where src file is part of project resource. In my project i have to download the zip use maven-dependency-plugin then then need to extract contents of inner zip. For this, any suggestion will be helpful at any point of time. – Shashank Nov 08 '16 at 13:57
  • @Shashank have you given a look at other solutions as well? (`maven-dependency-plugin` and `truezip-maven-plugin`) – Linuslabo Nov 08 '16 at 17:20
  • Yup, maven-dependency-plugin didn't failed to extract inner zip file contents. Can't use truezip, i think it only works when you have source file (zip) available in your project. – Shashank Nov 09 '16 at 11:51
  • The org.apache.portals.jetspeed-2:jetspeed-unpack-maven-plugin might be another option. – raner Feb 10 '20 at 22:29

0 Answers0