我有一个 Maven 项目,其结构为:
Project
|---lib
| |---<files and folders I want to include>
|
|---src
| |---<regular files and folders>
|
|---pom.xml
在我的 pom.xml 中,我有:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies-third-party</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>target/dist/lib/third-party</outputDirectory>
<excludeGroupIds>...</excludeGroupIds>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
它将我的所有 Maven 依赖项复制到 target/dist/lib/third-party
目录。我怎样才能将 lib(参见上面的结构)文件夹中的所有文件/文件夹包含到该位置?
最佳答案
由于这些文件是配置和属性文件,我将它们分类为资源并使用 maven-resources-plugin包括他们。
<resources>
<!-- The resources in the lib folder -->
<resource>
<directory>lib</directory>
<targetPath>${project.build.directory}/dist/lib/third-party</targetPath>
<!-- add this if you want to define parameters in these resources -->
<filtering>true</filtering>
</resource>
<!-- We need to redeclare the project resources again -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
关于java - Maven 依赖插件 - 包含文件和文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32229650/