创建空maven项目
1、File–>new–>project…
2.next
3.next
4.finish
5.配置pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://mons-logging</artifactId> <version>1.2</version> </dependency> </dependencies> <modules> <module>pdd-shop-application</module> <module>pdd-shop-appweb</module> <module>pdd-shop-application-impl</module> </modules> </project>创建module
创建java module
1、右键ppd-shop项目–>new–>project…
2.next
3.next
4.next
5.finish–>配置pom.xml
(主要把多余部分删除,junit只要在父工程的pom配置就可以了)
创建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、配置子项目依赖
<project 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"><modelVersion>4.0.0</modelVersion><parent><artifactId>pdd-shop</artifactId><groupId>pdd-shop</groupId><version>0.0.1-SNAPSHOT</version></parent><groupId>pdd-shop</groupId><artifactId>pdd-shop-appweb</artifactId><version>0.0.1-SNAPSHOT</version><packaging>war</packaging><name>pdd-shop-appweb Maven Webapp</name><build><finalName>pdd-shop-appweb</finalName><plugins><plugin><artifactId>maven-antrun-plugin</artifactId><executions><execution><id>copy-lib-src-webapps</id><phase>package</phase><configuration><tasks><delete dir="WebContent/WEB-INF/lib" /><copy todir="WebContent/WEB-INF/lib"><fileset dir="target/${artifactId}/WEB-INF/lib"><include name="*" /></fileset></copy></tasks></configuration><goals><goal>run</goal></goals></execution></executions></plugin></plugins></build><dependencies><dependency><groupId>${groupId}</groupId><artifactId>pdd-shop-application-impl</artifactId><version>${version}</version></dependency></dependencies></project>项目依赖
扩展
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。