我有一个结构的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 中的所有文件/文件夹(请参见上面的结构)文件夹包含在该位置?
答案 0 :(得分:1)
由于这些文件是配置和属性文件,我会将它们归类为资源,并使用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>
答案 1 :(得分:0)
它完全回答了你的问题