在父 pom 中使用子模块 属性

Using child module property in parent pom

我有一个定义 maven-war-plugin 的父 pom。

<plugin> 
 <groupId>org.apache.maven.plugins</groupId> 
 <artifactId>maven-war-plugin</artifactId> 
 <version>2.6</version> 
 <configuration> 
   <failOnMissingWebXml>false</failOnMissingWebXml> 
   <warName>${warname}</warName>
 </configuration> 
</plugin> 

我在子 pom 中声明 属性 ${warname}。当我尝试使用 Eclipse 的 'Run as server' 选项部署子 Web 模块时,warname 属性 未解析。请让我知道这种配置是否可行。

你不能那样做。您必须在父 pom 中设置 属性 并在子模块中使用它。这些属性仅适用于父级到子级,而不是相反。