idea创建聚合工程

idea创建聚合工程

    • 第一步:打开idea,新建一个空项目
    • 第二步:创建父工程tao_parent
    • 第三步创建tao_common工程,步骤一样File ->New ->Module
    • 第四步创建tao_manager,步骤和tao_common一样,父工程选择tao_parent
    • 第五步创建tao_manager_pojo
    • 第六步:创建tao_manager_mapper
    • 第七步创建tao_manager_service
    • 第八步创建tao_manager_web
    • 第九步tomcat配置

第一步:打开idea,新建一个空项目

idea创建聚合工程_第1张图片

第二步:创建父工程tao_parent

idea创建聚合工程_第2张图片
idea创建聚合工程_第3张图片
因为需要创建许多项目,所以在这里点击+号,输入信息name=archetypeCatalog value=internal,可以加快idea创建maven项目的速度
idea创建聚合工程_第4张图片
补全pom,注意打包为pom



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0modelVersion>
  <groupId>com.zygroupId>
  <artifactId>tao_parentartifactId>
  <version>1.0-SNAPSHOTversion>
  <packaging>pompackaging>
  <name>tao_parentname>
  <url>http://www.example.comurl>
  
  
  <properties>
    <junit.version>4.12junit.version>
    <spring.version>4.2.4.RELEASEspring.version>
    <mybatis.version>3.2.8mybatis.version>
    <mybatis.spring.version>1.2.2mybatis.spring.version>
    <mybatis.paginator.version>1.2.15mybatis.paginator.version>
    <mysql.version>5.1.32mysql.version>
    <slf4j.version>1.6.4slf4j.version>
    <jackson.version>2.4.2jackson.version>
    <druid.version>1.0.9druid.version>
    <httpclient.version>4.3.5httpclient.version>
    <jstl.version>1.2jstl.version>
    <servlet-api.version>2.5servlet-api.version>
    <jsp-api.version>2.0jsp-api.version>
    <joda-time.version>2.5joda-time.version>
    <commons-lang3.version>3.3.2commons-lang3.version>
    <commons-io.version>1.3.2commons-io.version>
    <commons-net.version>3.3commons-net.version>
    <pagehelper.version>3.4.2pagehelper.version>
    <jsqlparser.version>0.9.1jsqlparser.version>
    <commons-fileupload.version>1.3.1commons-fileupload.version>
    <jedis.version>2.7.2jedis.version>
    <solrj.version>4.10.3solrj.version>
  properties>

  
  <dependencyManagement>
    <dependencies>
      
      <dependency>
        <groupId>joda-timegroupId>
        <artifactId>joda-timeartifactId>
        <version>${joda-time.version}version>
      dependency>
      
      <dependency>
        <groupId>org.apache.commonsgroupId>
        <artifactId>commons-lang3artifactId>
        <version>${commons-lang3.version}version>
      dependency>
      <dependency>
        <groupId>org.apache.commonsgroupId>
        <artifactId>commons-ioartifactId>
        <version>${commons-io.version}version>
      dependency>
      <dependency>
        <groupId>commons-netgroupId>
        <artifactId>commons-netartifactId>
        <version>${commons-net.version}version>
      dependency>
      
      <dependency>
        <groupId>com.fasterxml.jackson.coregroupId>
        <artifactId>jackson-databindartifactId>
        <version>${jackson.version}version>
      dependency>
      
      <dependency>
        <groupId>org.apache.httpcomponentsgroupId>
        <artifactId>httpclientartifactId>
        <version>${httpclient.version}version>
      dependency>
      
      <dependency>
        <groupId>junitgroupId>
        <artifactId>junitartifactId>
        <version>${junit.version}version>
        <scope>testscope>
      dependency>
      
      <dependency>
        <groupId>org.slf4jgroupId>
        <artifactId>slf4j-log4j12artifactId>
        <version>${slf4j.version}version>
      dependency>
      
      <dependency>
        <groupId>org.mybatisgroupId>
        <artifactId>mybatisartifactId>
        <version>${mybatis.version}version>
      dependency>
      <dependency>
        <groupId>org.mybatisgroupId>
        <artifactId>mybatis-springartifactId>
        <version>${mybatis.spring.version}version>
      dependency>
      <dependency>
        <groupId>com.github.miemiedevgroupId>
        <artifactId>mybatis-paginatorartifactId>
        <version>${mybatis.paginator.version}version>
      dependency>
      <dependency>
        <groupId>com.github.pagehelpergroupId>
        <artifactId>pagehelperartifactId>
        <version>${pagehelper.version}version>
      dependency>
      
      <dependency>
        <groupId>mysqlgroupId>
        <artifactId>mysql-connector-javaartifactId>
        <version>${mysql.version}version>
      dependency>
      
      <dependency>
        <groupId>com.alibabagroupId>
        <artifactId>druidartifactId>
        <version>${druid.version}version>
      dependency>
      
      <dependency>
        <groupId>org.springframeworkgroupId>
        <artifactId>spring-contextartifactId>
        <version>${spring.version}version>
      dependency>
      <dependency>
        <groupId>org.springframeworkgroupId>
        <artifactId>spring-beansartifactId>
        <version>${spring.version}version>
      dependency>
      <dependency>
        <groupId>org.springframeworkgroupId>
        <artifactId>spring-webmvcartifactId>
        <version>${spring.version}version>
      dependency>
      <dependency>
        <groupId>org.springframeworkgroupId>
        <artifactId>spring-jdbcartifactId>
        <version>${spring.version}version>
      dependency>
      <dependency>
        <groupId>org.springframeworkgroupId>
        <artifactId>spring-aspectsartifactId>
        <version>${spring.version}version>
      dependency>
      
      <dependency>
        <groupId>jstlgroupId>
        <artifactId>jstlartifactId>
        <version>${jstl.version}version>
      dependency>
      <dependency>
        <groupId>javax.servletgroupId>
        <artifactId>servlet-apiartifactId>
        <version>${servlet-api.version}version>
        <scope>providedscope>
      dependency>
      <dependency>
        <groupId>javax.servletgroupId>
        <artifactId>jsp-apiartifactId>
        <version>${jsp-api.version}version>
        <scope>providedscope>
      dependency>
      
      <dependency>
        <groupId>commons-fileuploadgroupId>
        <artifactId>commons-fileuploadartifactId>
        <version>${commons-fileupload.version}version>
      dependency>
      
      <dependency>
        <groupId>redis.clientsgroupId>
        <artifactId>jedisartifactId>
        <version>${jedis.version}version>
      dependency>
      
      <dependency>
        <groupId>org.apache.solrgroupId>
        <artifactId>solr-solrjartifactId>
        <version>${solrj.version}version>
      dependency>
    dependencies>
  dependencyManagement>

  <build>
    <finalName>${project.artifactId}finalName>
    <plugins>
      
      <plugin>
        <groupId>org.apache.maven.pluginsgroupId>
        <artifactId>maven-resources-pluginartifactId>
        <version>2.7version>
        <configuration>
          <encoding>UTF-8encoding>
        configuration>
      plugin>
      
      <plugin>
        <groupId>org.apache.maven.pluginsgroupId>
        <artifactId>maven-compiler-pluginartifactId>
        <version>3.2version>
        <configuration>
          <source>1.7source>
          <target>1.7target>
          <encoding>UTF-8encoding>
        configuration>
      plugin>
    plugins>
    <pluginManagement>
      <plugins>
        
        <plugin>
          <groupId>org.apache.tomcat.mavengroupId>
          <artifactId>tomcat7-maven-pluginartifactId>
          <version>2.2version>
        plugin>
      plugins>
    pluginManagement>
  build>
project>

第三步创建tao_common工程,步骤一样File ->New ->Module

这里只选择maven,其他都不选
idea创建聚合工程_第5张图片
第一个3点:添加到哪个工程中,none表示不添加
第二个3点:选择父工程
idea创建聚合工程_第6张图片
pom


<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>tao_parentartifactId>
        <groupId>com.zygroupId>
        <version>1.0-SNAPSHOTversion>
        <relativePath>../tao_parent/pom.xmlrelativePath>
    parent>
    <modelVersion>4.0.0modelVersion>
    <artifactId>tao_commonartifactId>
    
    
    <dependencies>
        
        <dependency>
            <groupId>joda-timegroupId>
            <artifactId>joda-timeartifactId>
        dependency>
        
        <dependency>
            <groupId>org.apache.commonsgroupId>
            <artifactId>commons-lang3artifactId>
        dependency>
        <dependency>
            <groupId>org.apache.commonsgroupId>
            <artifactId>commons-ioartifactId>
        dependency>
        <dependency>
            <groupId>commons-netgroupId>
            <artifactId>commons-netartifactId>
        dependency>
        
        <dependency>
            <groupId>com.fasterxml.jackson.coregroupId>
            <artifactId>jackson-databindartifactId>
        dependency>
        
        <dependency>
            <groupId>org.apache.httpcomponentsgroupId>
            <artifactId>httpclientartifactId>
        dependency>
        
        <dependency>
            <groupId>junitgroupId>
            <artifactId>junitartifactId>
            <scope>testscope>
        dependency>
        
        <dependency>
            <groupId>org.slf4jgroupId>
            <artifactId>slf4j-log4j12artifactId>
        dependency>
    dependencies>
project>

第四步创建tao_manager,步骤和tao_common一样,父工程选择tao_parent

pom



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>tao_parentartifactId>
        <groupId>com.zygroupId>
        <version>1.0-SNAPSHOTversion>
        <relativePath>../tao_parent/pom.xmlrelativePath>
    parent>
    <modelVersion>4.0.0modelVersion>
    <artifactId>tao_managerartifactId>
    <packaging>pompackaging>
    <name>tao_managername>
    <url>http://www.example.comurl>

    <properties>
        <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
        <maven.compiler.source>1.7maven.compiler.source>
        <maven.compiler.target>1.7maven.compiler.target>
    properties>

    
    <dependencies>
        <dependency>
            <groupId>com.zygroupId>
            <artifactId>tao_commonartifactId>
            <version>1.0-SNAPSHOTversion>
        dependency>
    dependencies>


    
    <build>
        
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.mavengroupId>
                <artifactId>tomcat7-maven-pluginartifactId>
                <configuration>
                    <port>8080port>
                    <path>/path>
                configuration>
            plugin>
        plugins>
    build>
project>

第五步创建tao_manager_pojo

前几步与上面一样,接下来选择父工程为tao_manager
idea创建聚合工程_第7张图片
pojo不需要修改pom
创建pojo后tao_manager的pom文件会自动生成modules
idea创建聚合工程_第8张图片

第六步:创建tao_manager_mapper

步骤同上
pom



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>tao_managerartifactId>
        <groupId>com.zygroupId>
        <version>1.0-SNAPSHOTversion>
    parent>

    <modelVersion>4.0.0modelVersion>
    <artifactId>tao_manager_mapperartifactId>
    <name>tao_manager_mappername>
    <url>http://www.example.comurl>

    <properties>
        <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
        <maven.compiler.source>1.7maven.compiler.source>
        <maven.compiler.target>1.7maven.compiler.target>
    properties>

    <dependencies>
        <dependency>
            <groupId>com.zygroupId>
            <artifactId>tao_managet_pojoartifactId>
            <version>1.0-SNAPSHOTversion>
        dependency>
        <dependency>
            <groupId>junitgroupId>
            <artifactId>junitartifactId>
            <version>4.11version>
            <scope>testscope>
        dependency>
        
        <dependency>
            <groupId>org.mybatisgroupId>
            <artifactId>mybatisartifactId>
        dependency>
        <dependency>
            <groupId>org.mybatisgroupId>
            <artifactId>mybatis-springartifactId>
        dependency>
        <dependency>
            <groupId>com.github.miemiedevgroupId>
            <artifactId>mybatis-paginatorartifactId>
        dependency>
        <dependency>
            <groupId>com.github.pagehelpergroupId>
            <artifactId>pagehelperartifactId>
        dependency>
        
        <dependency>
            <groupId>mysqlgroupId>
            <artifactId>mysql-connector-javaartifactId>
        dependency>
        
        <dependency>
            <groupId>com.alibabagroupId>
            <artifactId>druidartifactId>
        dependency>
    dependencies>

    <build>
        
        <resources>
            <resource>
                <directory>src/main/javadirectory>
                <includes>
                    <include>**/*.propertiesinclude>
                    <include>**/*.xmlinclude>
                includes>
                <filtering>falsefiltering>
            resource>
        resources>
    build>
project>

第七步创建tao_manager_service

步骤同上
pom搭建



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>tao_managerartifactId>
        <groupId>com.zygroupId>
        <version>1.0-SNAPSHOTversion>
    parent>
    <modelVersion>4.0.0modelVersion>
    <artifactId>tao_manager_serviceartifactId>
    <name>tao_manager_servicename>
    <url>http://www.example.comurl>

    <properties>
        <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
        <maven.compiler.source>1.7maven.compiler.source>
        <maven.compiler.target>1.7maven.compiler.target>
    properties>

    <dependencies>
        <dependency>
            <groupId>com.zygroupId>
            <artifactId>tao_manager_mapperartifactId>
            <version>1.0-SNAPSHOTversion>
        dependency>
        <dependency>
            <groupId>junitgroupId>
            <artifactId>junitartifactId>
            <version>4.11version>
            <scope>testscope>
        dependency>
        
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-contextartifactId>
        dependency>
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-beansartifactId>
        dependency>
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-webmvcartifactId>
        dependency>
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-jdbcartifactId>
        dependency>
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-aspectsartifactId>
        dependency>

    dependencies>
project>

第八步创建tao_manager_web

pom搭建



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>tao_managerartifactId>
        <groupId>com.zygroupId>
        <version>1.0-SNAPSHOTversion>
    parent>
    <modelVersion>4.0.0modelVersion>
    <artifactId>tao_manager_webartifactId>
    <packaging>warpackaging>
    <name>tao_manager_web Maven Webappname>
    <url>http://www.example.comurl>

    <properties>
        <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
        <maven.compiler.source>1.7maven.compiler.source>
        <maven.compiler.target>1.7maven.compiler.target>
    properties>

    <dependencies>
        <dependency>
            <groupId>com.zygroupId>
            <artifactId>tao_manager_serviceartifactId>
            <version>1.0-SNAPSHOTversion>
        dependency>
        <dependency>
            <groupId>junitgroupId>
            <artifactId>junitartifactId>
            <version>4.11version>
            <scope>testscope>
        dependency>
        
        <dependency>
            <groupId>jstlgroupId>
            <artifactId>jstlartifactId>
        dependency>
        <dependency>
            <groupId>javax.servletgroupId>
            <artifactId>servlet-apiartifactId>
            <scope>providedscope>
        dependency>
        <dependency>
            <groupId>javax.servletgroupId>
            <artifactId>jsp-apiartifactId>
            <scope>providedscope>
        dependency>
        
        <dependency>
            <groupId>commons-fileuploadgroupId>
            <artifactId>commons-fileuploadartifactId>
        dependency>

    dependencies>

project>

第九步tomcat配置

idea创建聚合工程_第9张图片
parent和common是一样的clean install
idea创建聚合工程_第10张图片
manager是clean tomcat7:run
idea创建聚合工程_第11张图片

你可能感兴趣的:(杂货)