Maven子模块中的延迟属性评估
我在尝试在一个3级多模块项目中运行maven时遇到了一些问题 第一级是超级pom,它定义了antrun任务。它位于外部存储库中。 第二个是超级pom,只包含子模块的定义。假设它在/项目中 第三级包含子模块,其项位于/project/moduleN 在第一级,AntRun任务包括对“${project.basedir}”的调用 当我使用maven时,我转到第二级pom文件夹并运行mvn clean install 由于它只包含子模块,因此尝试编译它们,但${project.basedir}已被评估为是/project,而不是/project/moduleN 我想推迟对这些表达式的求值,以便用我的子模块中的值替换它们,而不是包含它们的pom中的值,但我找不到这样做的方法 以下是POM文件的摘录,以了解发生了什么: 超级POMMaven子模块中的延迟属性评估,maven,maven-3,Maven,Maven 3,我在尝试在一个3级多模块项目中运行maven时遇到了一些问题 第一级是超级pom,它定义了antrun任务。它位于外部存储库中。 第二个是超级pom,只包含子模块的定义。假设它在/项目中 第三级包含子模块,其项位于/project/moduleN 在第一级,AntRun任务包括对“${project.basedir}”的调用 当我使用maven时,我转到第二级pom文件夹并运行mvn clean install 由于它只包含子模块,因此尝试编译它们,但${project.basedir}已被评估
<groupId>org.example</groupId>
<artifactId>superpom</artifactId>
<packaging>pom</packaging>
...
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
...
<exec dir="${project.basedir}" ...></exec>
</plugin>
</plugins>
<parent>
<groupId>org.example</groupId>
<artifactId>superpom</artifactId>
</parent>
<groupId>org.example</groupId>
<artifactId>projectPom</artifactId>
<packaging>pom</packaging>
<modules>
<module>module1</module>
<module>module2</module>
</modules>
<parent>
<groupId>org.example</groupId>
<artifactId>projectPom</artifactId>
</parent>
<groupId>org.example</groupId>
<artifactId>moduleNPom</artifactId>
<packaging>jar</packaging>
org.example
超级妈妈
聚甲醛
...
maven antrun插件
...
项目POM
<groupId>org.example</groupId>
<artifactId>superpom</artifactId>
<packaging>pom</packaging>
...
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
...
<exec dir="${project.basedir}" ...></exec>
</plugin>
</plugins>
<parent>
<groupId>org.example</groupId>
<artifactId>superpom</artifactId>
</parent>
<groupId>org.example</groupId>
<artifactId>projectPom</artifactId>
<packaging>pom</packaging>
<modules>
<module>module1</module>
<module>module2</module>
</modules>
<parent>
<groupId>org.example</groupId>
<artifactId>projectPom</artifactId>
</parent>
<groupId>org.example</groupId>
<artifactId>moduleNPom</artifactId>
<packaging>jar</packaging>
org.example
超级妈妈
org.example
projectPom
聚甲醛
模块1
模2
模块POM
<groupId>org.example</groupId>
<artifactId>superpom</artifactId>
<packaging>pom</packaging>
...
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
...
<exec dir="${project.basedir}" ...></exec>
</plugin>
</plugins>
<parent>
<groupId>org.example</groupId>
<artifactId>superpom</artifactId>
</parent>
<groupId>org.example</groupId>
<artifactId>projectPom</artifactId>
<packaging>pom</packaging>
<modules>
<module>module1</module>
<module>module2</module>
</modules>
<parent>
<groupId>org.example</groupId>
<artifactId>projectPom</artifactId>
</parent>
<groupId>org.example</groupId>
<artifactId>moduleNPom</artifactId>
<packaging>jar</packaging>
org.example
projectPom
org.example
模聚甲醛
罐子
也许我们需要一些POM代码。听起来你的超级POM在讨论中没有那么重要。但是你让我感到困惑的是,你是在project
构建过程中试图影响子模块(moduleN
),还是在自己的构建过程中试图影响子模块。总之,一些POM代码片段会对我有所帮助。我更新了我的问题,将POM文件的摘录包括在内,pluginManagement
部分包含的antrun插件是什么?