I have the following dependency in maven
<dependency> <groupId>org.hyperic</groupId> <artifactId>sigar-dist</artifactId> <version>1.6.5.132</version> <type>zip</type> </dependency>
This creates sigar-dist-1.6.5.132.zip
in my repository. I have seen this question here, however I still can't make it work.
How can I unzip the sigar-dist.zip and place the content in a directory in my project? What is the mvn call I have to do to make it work?
org.apache.maven.plugins:maven-dependency-plugin:3.3.0:unpack. Description: Goal that retrieves a list of artifacts from the repository and unpacks them in a defined location.
The Maven WAR plugin is responsible for collecting and compiling all the dependencies, classes, and resources of the web application into a web application archive. There are some defined goals in the Maven WAR plugin: war: This is the default goal that is invoked during the packaging phase of the project.
A Maven artifact classifier is an optional and arbitrary string that gets appended to the generated artifact's name just after its version number. It distinguishes the artifacts built from the same POM but differing in content.
You can do it with dependencies:unpack-dependencies
:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.2</version> <executions> <execution> <id>unpack-sigar</id> <phase>package<!-- or any other valid maven phase --></phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <includeGroupIds>org.hyperic</includeGroupIds> <includeArtifactIds>sigar-dist</includeArtifactIds> <outputDirectory> ${project.build.directory}/wherever/you/want/it <!-- or: ${project.basedir}/wherever/you/want/it --> </outputDirectory> </configuration> </execution> </executions> </plugin>
Reference:
dependency:unpack-dependencies
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With