【发布时间】:2020-07-22 06:48:57
【问题描述】:
我需要将一些资源从工件复制到特定位置。 我需要更改位置而不使其变平。
例如:
my-res-artifact
\
someroot/subdir1/
+ myres1.dat
+ myres2.dat
\
subdir12
+ myres3.dat
我想将它复制到subdir1 目录,但删除someroot 根目录。这不适用于以下情况:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-additional-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>com.example</includeGroupIds>
<includeArtifactIds>my-res-artifact</includeArtifactIds>
<includes>someroot/subdir1/**</includes>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
目录结构someroot/subdir1/ 被保留。
【问题讨论】:
-
你为什么要做这样的事情? Spring Boot 就是这样工作的。为什么需要复制资源?
-
@khmarbaise 我有一个很好的理由,这超出了这个问题的分数。我也可以更改示例。
-
不,它们没有超出范围,因为它们对于您想要实现的目标很重要......
标签: maven build maven-dependency-plugin