如何解压用于编译源代码的工件?
在解开之前我是否需要复制tar文件?
我有类似下面的内容......
<build>
<plugins>
<plugin>
<artifactId>abcId</artifactId>
<version>1</version>
<executions>
<execution>
<id>abc untar</id>
<phase>process-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>tar</executable>
<workingDirectory>???</workingDirectory>
<arguments>
<argument>xvf abc.tar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
答案 0 :(得分:4)
您可以使用untar
目标dependency:unpack
来maven dependency plugin
工件。以下是example的修改版本。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>unpack</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>artifact-groupId</groupId>
<artifactId>the-artifact</artifactId>
<version>a.b</version>
<type>tar</type>
<outputDirectory>${project.build.directory}/artifactLocation</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>