eclipse中创建带有父子结构的项目

1、创建聚合模块
选择菜单项 File—>New—>Other,在弹出的对话框中选择Maven下的Maven Project,然后单击Next按钮,在弹出的New Maven Project 对话框中,使用默认选项(不要选择Create a simple project 选项,那样我们就能使用Maven Archetype),单击Next 按钮,此时m2eclipse 会提示我们选择一个Archetype。这里选择maven-archetype-quickstart,随后按照提示创建Maven聚合模块
 
 
注意:需要删除src等多余文件夹,因为聚合模块仅仅是帮助聚合其他模块构建的工具,其本身并没有实质的内容, 将pom文件的pom修改为pom.
 
2、创建模块(Java工程)
右击聚合模块,选择Maven—>New Maven Module Project,出现如下界面:
 
 
输入Module Name(不需要选中Create a simple project(skip archetype seletion)),点击下一步,其后创建方法与创建聚合模块相同。
 
3、创建模块(JavaWeb工程)
 
右击聚合模块,选择Maven—>New Maven Module Project,出现如下界面:
 
 
输入Module Name(不需要选中Create a simple project(skip archetype seletion)),点击下一步,弹出如下图界面:
 
 
Catalog选择Internal,Filter输入web,选择maven-archetype-webapp,创建Maven Web项目,随后步骤同上。
 
 
注释:1、Maven子项目默认按照maven-archetype-quickstart方式创建



例如 

父为 one-test 其中pom.xml文件内容为

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0


new-maven
one-test
0.0.1-SNAPSHOT
pom


parent
http://maven.apache.org



UTF-8
1.8
4.3.9.RELEASE








    commons-io
    commons-io
    2.4






junit
junit
3.8.1
test


antlr
antlr
2.7.7


com.alibaba
fastjson
1.2.28


com.googlecode.json-simple
json-simple
1.1.1


com.googlecode.plist
dd-plist
1.3


com.google.code.gson
gson
2.2.4



com.relayrides
pushy
0.3


com.thoughtworks.xstream
xstream
1.3.1


commons-codec
commons-codec
1.9


commons-collections
commons-collections
3.2.1


commons-fileupload
commons-fileupload
1.2.1


commons-httpclient
commons-httpclient
3.0.1


commons-io
commons-io
1.3.2


commons-logging
commons-logging
1.2


com.mchange
c3p0
0.9.2.1


com.mchange
mchange-commons-java
0.2.3.4


dom4j
dom4j
1.6.1


jaxen
jaxen
1.1.1




com.alibaba
druid
1.0.26





io.netty
netty-all
4.0.19.Final


javax.validation
validation-api
1.1.0.Final



free
cpdetector
1.0.10


free
chardet
1.0



free
json
1.0


org.apache.httpcomponents
httpclient
4.5


org.apache.httpcomponents
httpcore
4.4.1




org.slf4j
slf4j-api
1.5.8


org.slf4j
slf4j-log4j12
1.5.0



jcifs
jcifs
1.3.17



jexcelapi
jxl
2.4.2


jsptags
pager-taglib
2.0


log4j
log4j
1.2.14


mysql
mysql-connector-java
5.1.30


org.apache.poi
poi
3.8


org.apache.poi
poi-examples
3.8



org.apache.poi
poi-ooxml
3.8


org.apache.poi
poi-ooxml-schemas
3.8


org.apache.poi
poi-scratchpad
3.8


org.apache.xmlbeans
xmlbeans
2.3.0


org.javassist
javassist
3.18.1-GA


org.jboss.logging
jboss-logging
3.1.0.GA


org.jboss.spec.javax.transaction
jboss-transaction-api_1.1_spec
1.0.1.Final


stax
stax-api
1.0.1



org.hibernate
hibernate-core
4.2.7.Final


org.hibernate.common
hibernate-commons-annotations
4.0.2.Final


org.hibernate.javax.persistence
hibernate-jpa-2.0-api
1.0.1.Final


org.hibernate
hibernate-validator
5.0.1.Final



org.apache.tiles
tiles-api
3.0.3


org.apache.tiles
tiles-autotag-core-runtime
1.1.0


org.apache.tiles
tiles-core
3.0.3


org.apache.tiles
tiles-jsp
3.0.3


org.apache.tiles
tiles-request-api
1.0.3


org.apache.tiles
tiles-request-servlet
1.0.3


org.apache.tiles
tiles-servlet
3.0.3


org.apache.tiles
tiles-template
3.0.3



org.apache.commons
commons-pool2
2.4.2


redis.clients
jedis
2.9.0



org.springframework
spring-aop
${springversion}



org.springframework
spring-aspects
${springversion}


org.springframework
spring-beans
${springversion}


org.springframework
spring-context
${springversion}


org.springframework
spring-context-support
${springversion}


org.springframework
spring-core
${springversion}


org.springframework
spring-expression
${springversion}


org.springframework
spring-framework-bom
${springversion}
pom


org.springframework
spring-instrument
${springversion}


org.springframework
spring-instrument-tomcat
${springversion}


org.springframework
spring-jdbc
${springversion}


org.springframework
spring-jms
${springversion}


org.springframework
spring-orm
${springversion}


org.springframework
spring-oxm
${springversion}



org.springframework
spring-struts
3.2.7.RELEASE


org.springframework
spring-test
${springversion}


org.springframework
spring-tx
${springversion}


org.springframework
spring-web
${springversion}


org.springframework
spring-webmvc
${springversion}


org.springframework
spring-webmvc-portlet
${springversion}





org.aspectj
aspectjweaver
1.8.10






javax.servlet
jstl
1.2


javax.servlet
servlet-api
2.5
provided


taglibs
standard
1.1.2





org.testng
testng
6.8
test



org.apache.commons
commons-lang3
3.4







org.quartz-scheduler
quartz
2.3.0






one-in-one
one-in-tow


jiushiwan


org.apache.maven.plugins
maven-compiler-plugin
3.1

${project.build.jdkVersion}
${project.build.jdkVersion}
${project.build.sourceEncoding}



org.apache.tomcat.maven
tomcat7-maven-plugin
2.1

tomcat7
/jiushiwan
8080
http://localhost:8080/manager/html





src/main/java

**/*.properties
**/*.xml

false


src/main/resources

**/*.properties
**/*.xml

false


src/test/java

**/*.*








src/test/java







其下有一个子为普通java项目 pom.xml文件内容为

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  4.0.0
 
    new-maven
    one-test
    0.0.1-SNAPSHOT
 

  new-maven
  one-in-one
  0.0.1-SNAPSHOT
  one-in-one
  http://maven.apache.org
 
    UTF-8
 

 
   
      junit
      junit
      3.8.1
      test
   

 


然后还有一个子是javaweb项目 pom.xml内容为


xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4.0.0

new-maven
one-test
0.0.1-SNAPSHOT

new-maven
one-in-tow
0.0.1-SNAPSHOT
war
one-in-tow Maven Webapp
http://maven.apache.org


junit
junit
3.8.1
test






new-maven
one-in-one
0.0.1-SNAPSHOT



one-in-tow



你可能感兴趣的:(配置)