2012-07-08 25 views
0

我是新来的maven,发现自己陷入了困扰我的事情中。Maven - 从特定神器中排除资源

我有一个多模块项目,和我的父母的pom.xml包含以下插件:

<plugin> 
      <artifactId>maven-remote-resources-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>process-remote-resources</id> 
        <goals> 
         <goal>process</goal> 
        </goals> 
        <configuration> 
         <resourceBundles> 
          <resourceBundle> 
           ${shared.resources.version} 
          </resourceBundle> 
         </resourceBundles> 
         <includes> 
          <include>version.info</include> 
         </includes> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

此代码生成一个version.info文件,并将它们放在我的每一个模块的jar文件。 我想知道是否有可能使此代码创建仅2个模块的version.info文件出3

。举例来说,如果我有模块:A,B和C. 我想的版本。 info文件在A和B中,但不在C中。 我希望我解释得很好,以防万一请不要让我知道。

由于提前, MENY

回答

1

最好的解决办法这个插件配置中移动的项目/构建父POM的/ pluginManagement元素:

<pluginManagement> 
    <plugins> 
     <plugin> 
      <artifactId>maven-remote-resources-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>process-remote-resources</id> 
        <goals> 
         <goal>process</goal> 
        </goals> 
        <configuration> 
         <resourceBundles> 
          <resourceBundle> 
          ${shared.resources.version} 
          </resourceBundle> 
         </resourceBundles> 
         <includes> 
          <include>version.info</include> 
         </includes> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</pluginManagement> 

,并在项目称之为/建设/插件模块POMS:

<plugins> 
    <plugin> 
     <artifactId>maven-remote-resources-plugin</artifactId> 
    </plugin> 
</plugins> 

如果不允许父POM,例如重构然后覆盖以跳跃组插件配置成真或使用none阶段来禁用不需要的插件调用: http://thomaswabner.wordpress.com/2010/02/16/howto-disable-inherited-maven-plugin/

+0

感谢Andriy,我做了你的建议,并将它从父POM移动到相关模块的POM,它做了伎俩 – 2012-07-10 06:48:15