Java 这样的属性重写在Maven3中有效吗?
我有一个父pom.xml,其中包含Java 这样的属性重写在Maven3中有效吗?,java,maven,maven-3,Java,Maven,Maven 3,我有一个父pom.xml,其中包含maven编译器插件的build/pluginManagement/plugins/plugin部分。它包含的配置依赖于属性${targetJdk},该属性也在父pom中定义 我有一个子pom.xml,它使用来自父级的maven编译器插件。 但是子pom.xml用其他值重写${targetJdk}属性 家长: <properties> <targetJdk>1.8</targetJdk> </properties
maven编译器插件的build/pluginManagement/plugins/plugin部分。它包含的配置依赖于属性${targetJdk}
,该属性也在父pom中定义
我有一个子pom.xml,它使用来自父级的maven编译器插件
。
但是子pom.xml用其他值重写${targetJdk}
属性
家长:
<properties>
<targetJdk>1.8</targetJdk>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${targetJdk}</source>
<target>${targetJdk}</target>
<debug>true</debug>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
1.8
org.apache.maven.plugins
maven编译器插件
3.1
${targetJdk}
${targetJdk}
真的
真的
真的
真的
儿童:
<properties>
<targetJdk>1.7</targetJdk>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
1.7
org.apache.maven.plugins
maven编译器插件
所以问题是:当我构建一个子工件时,它将使用什么属性值?通常,当您在子pom中声明相同的插件和/或属性时,您会覆盖父项
您的孩子将使用1.7
我希望这会有所帮助。为了确定起见,请始终使用有效的Pom
帮助:有效的pom将使用1.7
。我也希望如此。你检查过了吗?为什么子模块会覆盖它?我有很多子模块,几乎都使用JDK1.8,但有些是1.7。所以我想覆盖这些的属性