我在 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
在我的存储库中。我见过这个 question here ,但是我仍然无法使其工作。
如何解压缩 sigar-dist.zip 并将内容放在我的项目的目录中?我必须执行什么 mvn 调用才能使其工作?
最佳答案
你可以用 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>
引用:
dependency:unpack-dependencies
关于maven-2 - 在 maven 中解压依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5388661/