0

我想从依赖项中获取资源文件并将其放到我的类路径或其他目录中。我尝试了 maven-dependency-plugin 但似乎我没有正确配置它。有谁知道该怎么做?

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.3</version>
    <executions>
         <execution>
         <id>get browsers.xml</id>
         <goals>
             <goal>unpack-dependencies</goal>
         </goals>
         <phase>generate-resources</phase>
         <configuration>
               <includeGroupIds>ru.fad.autotests</includeGroupIds>
               <includeArtifactIds>selenium-grid-browsers-local</includeArtifactIds>
               <includes>browsers.xml</includes>
               <outputDirectory>resources/</outputDirectory>
         </configuration>
         </execution>
      </executions>
  </plugin>

我在另一个工件中有文件“browsers.xml”,并希望将其复制到我的目录中。

4

1 回答 1

0

有几种不同的方法可以解决这个问题,但我认为最有效的解决方案是使用Maven Build Helper来实现这一build-helper:add-resource目标。

与其将依赖项解压缩到resources/(应该是仅受版本控制的文件),不如将所需的工件解压缩到target/,即target/my-resources/并从 build-helper 引用该目录。

于 2013-03-02T09:48:46.567 回答