首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

运用maven创建多模块web项目

2012-07-25 
使用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命令新建各个子模块
?

  1. mvn?archetype:create?-DgroupId=net.welken?-DartifactId=wudemo-common?-DpackageName=net.welken.wudemo.common????
  2. mvn?archetype:create?-DgroupId=net.welken?-DartifactId=wudemo-core?-DpackageName=net.welken.wudemo.core????
  3. mvn?archetype:create?-DgroupId=net.welken?-DartifactId=wudemo-model?-DpackageName=net.welken.wudemo.model????
  4. mvn?archetype:create?-DgroupId=net.welken?-DartifactId=wudemo-dal?-DpackageName=net.welken.wudemo.dal?????
  5. mvn?archetype:create?-DgroupId=net.welken?-DartifactId=wudemo-web?-DpackageName=net.welken.wudemo.web?-DarchetypeArtifactId=maven-archetype-webapp??

?

3.?在wudemo根目录下新建一个 pom.xml 配置文件
总pom.xml文件中,以下节点需注意:

  1. <groupId>net.welken</groupId>??<artifactId>wudemo-parent</artifactId>??
  2. <packaging>pom</packaging>??<name>wudemo?Parent?Project</name>??
  3. <version>1.0-SNAPSHOT</version>????
  4. <modules>??????<module>wudemo-common</module>??
  5. ????<module>wudemo-model</module>??????<module>wudemo-core</module>??
  6. ????<module>wudemo-dal</module>??????<module>wudemo-web</module>??
  7. </modules>??

?
?
4.?各个子pom.xml文件,添加parent节点

  1. <parent>???????<artifactId>wudemo-parent</artifactId>???
  2. ????<groupId>net.welken</groupId>???????<version>1.0-SNAPSHOT</version>???
  3. </parent>??
??


5.?各个子pom.xml文件,添加依赖管理dependencies节点

  1. <dependencies>??????<dependency>??
  2. ????????<groupId>junit</groupId>??????????<artifactId>junit</artifactId>??
  3. ????????<version>3.8.1</version>??????????<scope>test</scope>??
  4. ????</dependency>???????
  5. ????<dependency>??????????<groupId>net.welken</groupId>??
  6. ????????<artifactId>wudemo-common</artifactId>??????</dependency>??
  7. ????<dependency>??????????<groupId>net.welken</groupId>??
  8. ????????<artifactId>wudemo-dal</artifactId>??????</dependency>??
  9. ????<dependency>??????????<groupId>net.welken</groupId>??
  10. ????????<artifactId>wudemo-core</artifactId>??????</dependency>??
  11. ????<dependency>??????????<groupId>net.welken</groupId>??
  12. ????????<artifactId>wudemo-model</artifactId>??????</dependency>??
  13. </dependencies>?

热点排行