我在几个模块之间共享一个配置文件,我不希望将配置文件烘焙到任何JAR中.
如何对未指定为资源但位于与根POM处于同一级别的配置文件夹中的文件进行Maven do(resource)过滤?
您可以使用Maven Resources Plugin及其resources:copy-resources
mojo.从示例中:
复制资源
您可以使用mojo copy-resources复制不在默认maven布局中或未在build/resources元素中声明的资源,并将其附加到阶段
Run Code Online (Sandbox Code Playgroud)<project> ... <build> <plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.4.3</version> <executions> <execution> <id>copy-resources</id> <!-- here the phase you need --> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/extra-resources</outputDirectory> <resources> <resource> <directory>src/non-packaged-resources</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> ... </build> ... </project>
另一个选择是使用Maven AntRun插件和Ant过滤功能(例如使用Filter和/或Copy任务),但上面看起来很好.
归档时间: |
|
查看次数: |
1280 次 |
最近记录: |