在Maven中解压缩依赖项 [英] Unzip dependency in maven

查看:266
本文介绍了在Maven中解压缩依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在maven中具有以下依赖性

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>

这将在我的存储库中创建sigar-dist-1.6.5.132.zip. 我已经看到了这个此处的问题,但是我仍然无法使其正常工作

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.

如何解压缩sigar-dist.zip并将内容放置在项目的目录中?要使其正常工作,我需要执行什么mvn呼叫?

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?

推荐答案

您可以使用dependencies:unpack-dependencies做到这一点:

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>

参考:

这篇关于在Maven中解压缩依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆