运用maven创建多模块web项目
使用maven创建多模块web项目使用maven创建多模块web项目?1.?模块说明?wudemo-common(通用工具包)?wudemo-d
使用maven创建多模块web项目
使用maven创建多模块web项目
?
1.?模块说明
?wudemo-common(通用工具包)
?wudemo-dal(数据库访问层)
?wudemo-model(实体POJO)
?wudemo-core(业务核心)
?wudemo-web(web)
?
2.?进入wudemo目录,maven命令新建各个子模块
?
- mvn?archetype:create?-DgroupId=net.welken?-DartifactId=wudemo-common?-DpackageName=net.welken.wudemo.common????
- mvn?archetype:create?-DgroupId=net.welken?-DartifactId=wudemo-core?-DpackageName=net.welken.wudemo.core????
- mvn?archetype:create?-DgroupId=net.welken?-DartifactId=wudemo-model?-DpackageName=net.welken.wudemo.model????
- mvn?archetype:create?-DgroupId=net.welken?-DartifactId=wudemo-dal?-DpackageName=net.welken.wudemo.dal?????
- mvn?archetype:create?-DgroupId=net.welken?-DartifactId=wudemo-web?-DpackageName=net.welken.wudemo.web?-DarchetypeArtifactId=maven-archetype-webapp??
?
3.?在wudemo根目录下新建一个 pom.xml 配置文件
总pom.xml文件中,以下节点需注意:
- <groupId>net.welken</groupId>??<artifactId>wudemo-parent</artifactId>??
- <packaging>pom</packaging>??<name>wudemo?Parent?Project</name>??
- <version>1.0-SNAPSHOT</version>????
- <modules>??????<module>wudemo-common</module>??
- ????<module>wudemo-model</module>??????<module>wudemo-core</module>??
- ????<module>wudemo-dal</module>??????<module>wudemo-web</module>??
- </modules>??
?
?
4.?各个子pom.xml文件,添加parent节点
- <parent>???????<artifactId>wudemo-parent</artifactId>???
- ????<groupId>net.welken</groupId>???????<version>1.0-SNAPSHOT</version>???
- </parent>??
??
5.?各个子pom.xml文件,添加依赖管理dependencies节点
- <dependencies>??????<dependency>??
- ????????<groupId>junit</groupId>??????????<artifactId>junit</artifactId>??
- ????????<version>3.8.1</version>??????????<scope>test</scope>??
- ????</dependency>???????
- ????<dependency>??????????<groupId>net.welken</groupId>??
- ????????<artifactId>wudemo-common</artifactId>??????</dependency>??
- ????<dependency>??????????<groupId>net.welken</groupId>??
- ????????<artifactId>wudemo-dal</artifactId>??????</dependency>??
- ????<dependency>??????????<groupId>net.welken</groupId>??
- ????????<artifactId>wudemo-core</artifactId>??????</dependency>??
- ????<dependency>??????????<groupId>net.welken</groupId>??
- ????????<artifactId>wudemo-model</artifactId>??????</dependency>??
- </dependencies>?