如何使用eclipse搭建maven多module项目(构建父子项目)
创建空maven项目
1、File–>new–>project…
2.next
3.next
4.finish
5.配置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
pdd-shop
pdd-shop
0.0.1-SNAPSHOT
pom
pdd-shop
http://maven.apache.org
UTF-8
4.11
4.0.0.RELEASE
pdd-shop
org.apache.maven.plugins
<artifactId>maven-compiler-plugin
2.3.2
1.6
1.6
org.apache.maven.plugins
maven-jar-plugin
2.5
true
true
junit
junit
${junit.version}
org.springframework
spring-web
${spring.version}
org.springframework
spring-webmvc
${spring.version}
commons-logging
commons-logging
1.2
pdd-shop-application
pdd-shop-appweb
pdd-shop-application-impl
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
pdd-shop
pdd-shop
0.0.1-SNAPSHOT
pom
pdd-shop
http://maven.apache.org
UTF-8
4.11
4.0.0.RELEASE
pdd-shop
org.apache.maven.plugins
<artifactId>maven-compiler-plugin
2.3.2
1.6
1.6
org.apache.maven.plugins
maven-jar-plugin
2.5
true
true
junit
junit
${junit.version}
org.springframework
spring-web
${spring.version}
org.springframework
spring-webmvc
${spring.version}
commons-logging
commons-logging
1.2
pdd-shop-application
pdd-shop-appweb
pdd-shop-application-impl
创建module
创建java module
1、右键ppd-shop项目–>new–>project…
2.next
3.next
4.next
5.finish–>配置pom.xml
(主要把多余部分删除,junit只要在父工程的pom配置就可以了)
xmlns:xsi="http://w3.org/2001/XMLSchema-instance">
4.0.0
pdd-shop
pdd-shop
0.0.1-SNAPSHOT
pdd-shop
pdd-shop-application
0.0.1-SNAPSHOT
pdd-shop-application
xmlns:xsi="http://w3.org/2001/XMLSchema-instance">
4.0.0
pdd-shop
pdd-shop
0.0.1-SNAPSHOT
pdd-shop
pdd-shop-application
0.0.1-SNAPSHOT
pdd-shop-application
创建web module
1.与创建java module的1、2点一样;
2.next
3.把包名定义下~
4.右键pdd-shop-appweb项目–>properties–>Project Facets–>Convert to faceted form..
这里选2.4版本的web工程是因为楼主用的是tomcat 6.0啦,按自己实际情况去修改
5.配置pom.xml
配置中有两点说明下:1、把jar包自动拷贝到web-inf目录地下,这个搞web开发都懂是为什么了;2、配置子项目依赖
xmlns:xsi="http://w3.org/2001/XMLSchema-instance">
4.0.0
pdd-shop
pdd-shop
0.0.1-SNAPSHOT
pdd-shop
pdd-shop-appweb
0.0.1-SNAPSHOT
war
pdd-shop-appweb Maven Webapp
pdd-shop-appweb
maven-antrun-plugin
copy-lib-src-webapps
package
run
${groupId}
pdd-shop-application-impl
${version}
xmlns:xsi="http://w3.org/2001/XMLSchema-instance">
4.0.0
pdd-shop
pdd-shop
0.0.1-SNAPSHOT
pdd-shop
pdd-shop-appweb
0.0.1-SNAPSHOT
war
pdd-shop-appweb Maven Webapp
pdd-shop-appweb
maven-antrun-plugin
copy-lib-src-webapps
package
run
${groupId}
pdd-shop-application-impl
${version}
项目依赖
扩展
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
暂时没有评论,来抢沙发吧~