使用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.   
  3. mvn archetype:create -DgroupId=net.welken -DartifactId=wudemo-core -DpackageName=net.welken.wudemo.core  
  4.   
  5. mvn archetype:create -DgroupId=net.welken -DartifactId=wudemo-model -DpackageName=net.welken.wudemo.model  
  6.   
  7. mvn archetype:create -DgroupId=net.welken -DartifactId=wudemo-dal -DpackageName=net.welken.wudemo.dal   
  8.   
  9. 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 >   
  2. < artifactId > wudemo-parent </ artifactId >   
  3. < packaging > pom </ packaging >   
  4. < name > wudemo Parent Project </ name >   
  5. < version > 1.0-SNAPSHOT </ version >   
  6.   
  7. < modules >   
  8.     < module > wudemo-common </ module >   
  9.     < module > wudemo-model </ module >   
  10.     < module > wudemo-core </ module >   
  11.     < module > wudemo-dal </ module >   
  12.     < module > wudemo-web </ module >   
  13. </ modules >   

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

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


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

  1. < dependencies >   
  2.     < dependency >   
  3.         < groupId > junit </ groupId >   
  4.         < artifactId > junit </ artifactId >   
  5.         < version > 3.8.1 </ version >   
  6.         < scope > test </ scope >   
  7.     </ dependency >   
  8.      
  9.     < dependency >   
  10.         < groupId > net.welken </ groupId >   
  11.         < artifactId > wudemo-common </ artifactId >   
  12.     </ dependency >   
  13.     < dependency >   
  14.         < groupId > net.welken </ groupId >   
  15.         < artifactId > wudemo-dal </ artifactId >   
  16.     </ dependency >   
  17.     < dependency >   
  18.         < groupId > net.welken </ groupId >   
  19.         < artifactId > wudemo-core </ artifactId >   
  20.     </ dependency >   
  21.     < dependency >   
  22.         < groupId > net.welken </ groupId >   
  23.         < artifactId > wudemo-model </ artifactId >   
  24.     </ dependency >   
  25. </ dependencies >  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值