maven读取包含多个模块的pom.xml并写入文件



我们有" master"pom.xml文件并具有多个模块,使用maven-antrun-plugin或其他插件,我们如何能够通过将文件写入此主pom.xml中的所有模块文件夹来实现?想要存储一个包含"${project.version}"的文件。例如,我们运行mvn clean verify,我们想从这个主pom.xml中检索版本,并将其作为文件存储到所有多个模块中。

project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mp</groupId>
<artifactId>parentApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parentApp</name>
<description>This is just to test pom inheritance</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>../example1</module>
<module>../example2</module>
<module>../example3</module>
<module>../example4</module>
<module>../example5</module>
..
..

没关系-我们可以添加exec-maven-plugin来运行bash脚本列出所有多个模块,for循环-将文件夹复制到所有模块。

最新更新