gpt4 book ai didi

maven - 我怎样才能在 Maven 中解压 Artifact ?

转载 作者:行者123 更新时间:2023-12-02 15:39:01 26 4
gpt4 key购买 nike

如何解压 Artifact 以用于编译我的源代码?

我需要在解压之前复制 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>

最佳答案

您可以使用maven 依赖插件dependency:unpack 目标来untar Artifact 。这是 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>

关于maven - 我怎样才能在 Maven 中解压 Artifact ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11513300/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com