How to Unzip arbitrary files using pom.xml in maven
Asked Answered
E

2

12

I have a zip file in the path "C:\ptc\Windchill_10.1\Windchill" . Please can anyone tell me how to unzip this file using maven

Esthonia answered 5/7, 2013 at 10:44 Comment(0)
M
17

Maven has a plugin to work with Ant. With that plugin you can create Ant-Tasks, this tasks are a sequence of xml instructions that you can use to (virtually) anything you need.

A piece of code that you can use as inspiration:

<plugins>
   <plugin>
      <artifactId>maven-antrun-plugin</artifactId>
      <version>1.8</version>
      <executions>
         <execution>
            <phase>generate-resources</phase>
            <configuration>
               <tasks>
                  <echo message="unzipping file" />
                  <unzip src="output/inner.zip" dest="output/" />
               </tasks>
            </configuration>
            <goals>
               <goal>run</goal>
            </goals>
         </execution>
      </executions>
   </plugin>
</plugins>

source: https://ant.apache.org/manual/Tasks/unzip.html

Mucilage answered 7/6, 2016 at 13:18 Comment(1)
A more modern, similar solution is with TrueZip as stated in another answer, which I could sucessfully use.Cockneyism
M
0

Maven has a plugin named dependency plugin which helps you deal with artifacts, you can check documentation here

If your requirement is to unpack the dependencies and their transitive dependencies, take a look here

You can also take a look at solution provided in question here

Mohock answered 5/7, 2013 at 11:55 Comment(2)
It is clear that galme is not referring to a dependency, and so this is not a solution. There are many questions already devoted to unzipping dependencies, but few if any to unzipping files on a given path.Cleanup
@Mitch the reason I mentioned unzipping dependency is because the folder mentioned by op is where the windchill product keeps jar files typically. I realized that op is trying to open those jar files hence my answer in that direction.Mohock

© 2022 - 2024 — McMap. All rights reserved.