IDEA新建maven父子项目

本文详细介绍了如何在IntelliJ IDEA中创建Maven父子项目,包括创建空项目、设置父工程e3-parent、创建子工程e3-common、e3-manager-pojo等,并提供了各步骤的具体操作及修改pom.xml的细节,旨在帮助开发者理解并掌握Maven多模块项目的构建过程。
摘要由CSDN通过智能技术生成

1       项目视图

 

 

2       创建

2.1  总目录 空项目

2.1.1   第一步

 

2.1.2   第二步

 

2.1.3   第三步 结果

 

 

2.2  父工程 e3-parent

2.2.1   第一步

选择File–>New–>Module,进入New Module页面:

 

2.2.2   第二步

 

2.2.3   第三步

 

2.2.4   第四步 指定maven

 

2.2.5   第五步 指定路径

 

2.2.6   第六步 修改pom.xml

 

2.2.7   第七步 删掉main

 

2.3  父工程 e3-common 继承

2.3.1   第一步

选中父工程,再次file->new->module->next…这次是新建子工程,就要按自己的需要选择模板了,我这里选个web的。 

 

 

2.3.2   第二步     清除父模块

由于这个是和e3同级,不存在儿子关系

 

2.3.3   第三步

 

 

 

2.3.4   第四步 修改pom.xml

 

2.3.5   第五步 删除 webapp

 

 

2.3.6   其他:

父工程e3-manager 继承

 

 

 

2.4  子工程e3-manager-pojo

2.4.1   第一步

选中父工程,再次file->new->module->next…这次是新建子工程,就要按自己的需要选择模板了,我这里选个web的。 

 

 

2.4.2   第二步     添加父模块

 

 

 

2.4.3   第三步

 

 

 

2.4.4   第四步 修改pom.xml

 

2.4.5   第五步 删除 webapp

 

2.4.6   其他

子工程类似

 

 

 

类似,改为war,不删除

 

2.5  E3-magger

 

唯一区别

3       配置

3.1  基本配置

 

3.2  Maven服务器

启动tomcat插件:

clean tomcat7:run

 

 

 

3.3  先部署

可能是common-parentcommon-utils没有安装到本地仓库,出现的错误是找不到common-utilsjar包,那就需要我们安装一下。 

 

 

 

 

4       文件

4.1  e3-parent

4.1.1   pom.xml

 

[html]  view plain  copy
 
  1. <modelVersion>4.0.0</modelVersion>  
  2.  <groupId>cn.e3mall</groupId>  
  3.  <artifactId>e3-parent</artifactId>  
  4.  <packaging>pom</packaging>  
  5.  <version>1.0-SNAPSHOT</version>  
  6.    
  7.  <name>e3-parent</name>  
  8.  <url>http://maven.apache.org</url>  
  9.    
  10.  <!-- 集中定义依赖版本号-->  
  11.  <properties>  
  12.    <junit.version>4.12</junit.version>  
  13.    <spring.version>4.2.4.RELEASE</spring.version>  
  14.    <aspectjweaver.version>1.6.8</aspectjweaver.version>  
  15.    <aopalliance.version>1.0</aopalliance.version>  
  16.    <mybatis.version>3.2.8</mybatis.version>  
  17.    <mybatis.spring.version>1.2.2</mybatis.spring.version>  
  18.    <mybatis.paginator.version>1.2.15</mybatis.paginator.version>  
  19.    <mysql.version>5.1.32</mysql.version>  
  20.    <slf4j.version>1.6.4</slf4j.version>  
  21.    <jackson.version>2.4.2</jackson.version>  
  22.    <fastjson.version>1.2.38</fastjson.version>  
  23.    <druid.version>1.0.9</druid.version>  
  24.    <httpclient.version>4.3.5</httpclient.version>  
  25.    <jstl.version>1.2</jstl.version>  
  26.    <servlet-api.version>2.5</servlet-api.version>  
  27.    <jsp-api.version>2.0</jsp-api.version>  
  28.    <joda-time.version>2.5</joda-time.version>  
  29.    <commons-lang3.version>3.3.2</commons-lang3.version>  
  30.    <commons-io.version>1.3.2</commons-io.version>  
  31.    <commons-net.version>3.3</commons-net.version>  
  32.    <pagehelper.version>5.0.0</pagehelper.version>  
  33.    <jsqlparser.version>0.9.1</jsqlparser.version>  
  34.    <commons-fileupload.version>1.3.1</commons-fileupload.version>  
  35.    <jedis.version>2.7.2</jedis.version>  
  36.    <solrj.version>4.10.3</solrj.version>  
  37.    <dubbo.version>2.5.3</dubbo.version>  
  38.    <zookeeper.version>3.4.7</zookeeper.version>  
  39.    <zkclient.version>0.1</zkclient.version>  
  40.    <activemq.version>5.11.2</activemq.version>  
  41.    <freemarker.version>2.3.23</freemarker.version>  
  42.     <quartz.version>2.2.2</quartz.version>  
  43.  </properties>  
  44.    
  45.  <dependencyManagement>  
  46.    <dependencies>  
  47.      <!-- 时间操作组件 -->  
  48.      <dependency>  
  49.        <groupId>joda-time</groupId>  
  50.        <artifactId>joda-time</artifactId>  
  51.        <version>${joda-time.version}</version>  
  52.      </dependency>  
  53.      <!-- Apache工具组件 -->  
  54.      <dependency>  
  55.        <groupId>org.apache.commons</groupId>  
  56.        <artifactId>commons-lang3</artifactId>  
  57.        <version>${commons-lang3.version}</version>  
  58.      </dependency>  
  59.      <dependency>  
  60.        <groupId>org.apache.commons</groupId>  
  61.        <artifactId>commons-io</artifactId>  
  62.        <version>${commons-io.version}</version>  
  63.      </dependency>  
  64.      <dependency>  
  65.        <groupId>commons-net</groupId>  
  66.        <artifactId>commons-net</artifactId>  
  67.        <version>${commons-net.version}</version>  
  68.      </dependency>  
  69.      <!-- Jackson Json处理工具包 -->  
  70.      <dependency>  
  71.        <groupId>com.fasterxml.jackson.core</groupId>  
  72.        <artifactId>jackson-databind</artifactId>  
  73.        <version>${jackson.version}</version>  
  74.      </dependency>  
  75.      <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson  
  76.          支持JSONObject-->  
  77.      <dependency>  
  78.        <groupId>com.alibaba</groupId>  
  79.        <artifactId>fastjson</artifactId>  
  80.        <version>${fastjson.version}</version>  
  81.      </dependency>  
  82.    
  83.      <!-- httpclient -->  
  84.      <dependency>  
  85.        <groupId>org.apache.httpcomponents</groupId>  
  86.        <artifactId>httpclient</artifactId>  
  87.        <version>${httpclient.version}</version>  
  88.      </dependency>  
  89.      <!-- quartz任务调度框架 -->  
  90.      <dependency>  
  91.        <groupId>org.quartz-scheduler</groupId>  
  92.        <artifactId>quartz</artifactId>  
  93.        <version>${quartz.version}</version>  
  94.      </dependency>  
  95.      <!-- 单元测试 -->  
  96.      <dependency>  
  97.         <groupId>junit</groupId>  
  98.        <artifactId>junit</artifactId>  
  99.        <version>${junit.version}</version>  
  100.        <scope>test</scope>  
  101.      </dependency>  
  102.      <!-- 日志处理 -->  
  103.      <dependency>  
  104.        <groupId>org.slf4j</groupId>  
  105.        <artifactId>slf4j-log4j12</artifactId>  
  106.        <version>${slf4j.version}</version>  
  107.      </dependency>  
  108.    
  109.      <!-- Mybatis -->  
  110.      <dependency>  
  111.        <groupId>org.mybatis</groupId>  
  112.        <artifactId>mybatis</artifactId>  
  113.        <version>${mybatis.version}</version>  
  114.      </dependency>  
  115.      <dependency>  
  116.        <groupId>org.mybatis</groupId>  
  117.        <artifactId>mybatis-spring</artifactId>  
  118.        <version>${mybatis.spring.version}</version>  
  119.      </dependency>  
  120.      <dependency>  
  121.        <groupId>com.github.miemiedev</groupId>  
  122.        <artifactId>mybatis-paginator</artifactId>  
  123.        <version>${mybatis.paginator.version}</version>  
  124.      </dependency>  
  125.      <dependency>  
  126.        <groupId>com.github.pagehelper</groupId>  
  127.        <artifactId>pagehelper</artifactId>  
  128.        <version>${pagehelper.version}</version>  
  129.      </dependency>  
  130.      <!-- MySql -->  
  131.      <dependency>  
  132.        <groupId>mysql</groupId>  
  133.        <artifactId>mysql-connector-java</artifactId>  
  134.        <version>${mysql.version}</version>  
  135.       </dependency>  
  136.      <!-- 连接池 -->  
  137.      <dependency>  
  138.        <groupId>com.alibaba</groupId>  
  139.        <artifactId>druid</artifactId>  
  140.        <version>${druid.version}</version>  
  141.      </dependency>  
  142.      <!-- Spring -->  
  143.      <!-- Spring Core -->  
  144.      <dependency>  
  145.        <groupId>org.springframework</groupId>  
  146.        <artifactId>spring-core</artifactId>  
  147.        <version>${spring.version}</version>  
  148.      </dependency>  
  149.      <dependency>  
  150.        <groupId>org.springframework</groupId>  
  151.        <artifactId>spring-beans</artifactId>  
  152.        <version>${spring.version}</version>  
  153.      </dependency>  
  154.      <dependency>  
  155.        <groupId>org.springframework</groupId
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值