`
adapterofcoms
  • 浏览: 72288 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

Maven Multi-module Inheritance

 
阅读更多

 

所有用Maven管理的真实的项目都应该是分模块的,每个模块都对应着一个pom.xml.

 

1.聚合 POM与继承关系中的父POM的 packaging都是pom
2.聚合模块与继承关系中的父模块除了 POM之外都没有实际的内容。

注:在现有的实际项目中一个 POM既是聚合POM,又是父 POM,这么做主要是为了方便
http://juvenshun.iteye.com/blog/305865

In eclipse Run As -->maven build :  deploy -e
在parent pom.xml中
<modules>
    <module>../childModuleName</module>
    ......
  </modules>
在child pom.xml中
<parent>
    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <relativePath>../parent/pom.xml</relativePath>
  </parent>
对parent  maven build 会build all modules.

maven build in eclipse:
Run As/Debug As--> maven clean, install, deploy ......  tomcat:run/tomcat7:run...

tomcat7-maven-plugin / maven-jetty-plugin  maven-eclipse-plugin

maven-resources-plugin #for mybatis.mapper.xml
<plugin> 
            <artifactId>maven-resources-plugin</artifactId> 
            <version>2.7</version> 
            <executions> 
                <execution> 
                    <id>copy-xmls</id> 
                    <phase>process-sources</phase> 
                    <goals> 
                        <goal>copy-resources</goal> 
                    </goals> 
                    <configuration> 
                        <outputDirectory>${basedir}/target/classes</outputDirectory> 
                        <resources> 
                            <resource> 
                                <directory>${basedir}/src/main/java</directory> 
                                <includes> 
                                    <include>**/*.xml</include><!--e.g: mybatis.mapper.xml-->
                                    <!--other res type-->
                                </includes> 
                            </resource> 
                        </resources> 
                    </configuration> 
                </execution> 
            </executions> 
        </plugin>

Struts2 scanning the actions in Jars:
<!--XXX-*-web-0.0.1-SNAPSHOT.jar-->   
 <constant name="struts.convention.action.includeJars" value=".*?/XXX-.+?-web.*?\.jar(!/)?"/>
并且XXX-*-web-0.0.1-SNAPSHOT.jar中必须包含标准META-INF/MANIFEST.MF
-----------------------------------------------------------------------------------------------------------

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics