您在Maven的资源没有得到解决性能

问题描述:

鉴于SRC以下属性/主/资源/的hello.xml您在Maven的资源没有得到解决性能

<test>${resolved.property}</test> 
<test>${unresolved.property}</test> 

随着性能:

resolved.property=test 

如何验证,通过MVN后去:资源过滤,如果有任何未解决的属性留下?

在资源过滤完成后,您可以使用XML Maven Plugin来验证您的XML文件。

这个插件可以根据模式验证XML文件,甚至只需检查它们是否格式正确(这将足以验证您的XML文件不包含属性标记)。

您声明插件像这样:

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>xml-maven-plugin</artifactId> 
    <executions> 
    <execution> 
     <phase>process-resources</phase> 
     <goals> 
     <goal>validate</goal> 
     </goals> 
    </execution> 
    </executions> 
    <configuration> 
    <validationSets> 
     <validationSet> 
      <dir>... your xml dir ...</dir> 
      <includes> 
       <include>*.xml</include> 
      </includes> 
     </validationSet> 
    </validationSets> 
    </configuration> 
</plugin> 

注:因为要确保验证运行你的资源已被过滤后使用<phase>process-resources</phase>这里重要的。