maven构建ssh工程

Posted wyhluckydog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven构建ssh工程相关的知识,希望对你有一定的参考价值。

1.1 需求

在web工程的基础上实现ssh工程的创建,规范依赖管理。

1.2 数据库环境

使用之前学习hibernate创建的数据库:

  

1.3 创建父工程

选择创建Maven Project

点击next,进入下一个页面。在这个页面中选中create a simple project,这样创建的工程就会给我们自动生成目录。

点击next,进入下一个页面。注意此处:packaging类型为pom类型。

点击finish,完成父工程的创建。

1.4 定义父工程的pom.xml

maven工程首先要识别依赖,web工程实现SSH整合,需要依赖struts2.3.24spring4.2.4hibernate5.0.7等,在pom.xml添加工程如下依赖:

分两步:

1)锁定依赖版本

2)添加依赖

<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.0</modelVersion>
  <groupId>com.huida.crm</groupId>
  <artifactId>ssh-parent</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
  <modules>
      <module>ssh-dao</module>
      <module>ssh-service</module>
      <module>ssh-web</module>
  </modules>
  <!-- 为了确定每个框架的版本号 -->

  <!-- 锁定版本 -->
      <properties>
         <spring.version>4.2.4.RELEASE</spring.version>
        <struts2.version>2.3.24</struts2.version>
        <hibernate.version>5.0.7.Final</hibernate.version>
        <slf4j.version>1.6.6</slf4j.version>
        <log4j.version>1.2.12</log4j.version>
        <shiro.version>1.2.3</shiro.version>
        <cxf.version>3.0.1</cxf.version>
        <c3p0.version>0.9.1.2</c3p0.version> 
        <mysql.version>5.1.6</mysql.version>
    </properties>
      <!-- 锁定版本,struts2-2.3.24、spring4.2.4、hibernate5.0.7 -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aspects</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-orm</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>${hibernate.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.struts</groupId>
                <artifactId>struts2-core</artifactId>
                <version>${struts2.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.struts</groupId>
                <artifactId>struts2-spring-plugin</artifactId>
                <version>${struts2.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>
  
  <dependencies>
      <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.4</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.1.37</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.9.1</version>
        </dependency>
        <!-- <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>2.2.1</version>
        </dependency> -->
        <dependency>
          <groupId>commons-fileupload</groupId>
          <artifactId>commons-fileupload</artifactId>
          <version>1.3.1</version>
        </dependency>
    
        <!-- jstl -->
         <dependency>
          <groupId>jstl</groupId>
          <artifactId>jstl</artifactId>
          <version>1.2</version>
        </dependency>
        
        <!-- shiro -->
         <!-- apache shiro dependencies -->
         <!-- <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-all</artifactId>
            <version>${shiro.version}</version>
         </dependency> -->

      
       <!-- spring -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.6.8</version>
        </dependency>
        
         <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
        </dependency>
        
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context</artifactId>
          <version>${spring.version}</version>
        </dependency>
        
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context-support</artifactId>
          <version>${spring.version}</version>
        </dependency>
        
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
          <version>${spring.version}</version>
        </dependency>

        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-orm</artifactId>
          <version>${spring.version}</version>
        </dependency>
        
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-beans</artifactId>
          <version>${spring.version}</version>
        </dependency>
        
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-core</artifactId>
          <version>${spring.version}</version>
        </dependency>
        
    
        
        <!-- struts2  begin -->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>${struts2.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>javassist</artifactId>
                    <groupId>javassist</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
            <version>${struts2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-json-plugin</artifactId>
            <version>${struts2.version}</version>
        </dependency>
        <dependency>
              <groupId>org.apache.struts</groupId>
              <artifactId>struts2-convention-plugin</artifactId>
              <version>${struts2.version}</version>
          </dependency>
        <!-- struts2  end -->
        
        <!-- hibernate begin -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.2.1.Final</version>
        </dependency>
        <!-- hibernate end -->
        
        <dependency>
              <groupId>c3p0</groupId>
              <artifactId>c3p0</artifactId>
              <version>${c3p0.version}</version>
          </dependency>
        
        <!-- <dependency> 
            <groupId>org.apache.cxf</groupId> 
            <artifactId>cxf-rt-frontend-jaxws</artifactId> 
            <version>${cxf.version}</version> 
        </dependency> 
        <dependency> 
            <groupId>org.apache.cxf</groupId> 
            <artifactId>cxf-rt-transports-http</artifactId> 
            <version>${cxf.version}</version> 
        </dependency> -->
        
        <!-- log start -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <!-- log end -->
        
        <!-- Javamail -->
    <!--     <dependency>
          <groupId>javax.mail</groupId>
          <artifactId>mail</artifactId>
          <version>1.4.4</version>
        </dependency> -->
        
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
    
        <dependency>
            <groupId>org.codehaus.xfire</groupId>
            <artifactId>xfire-core</artifactId>
            <version>1.2.6</version>
        </dependency> 
        
        <dependency>
           <groupId>dom4j</groupId>
           <artifactId>dom4j</artifactId>
           <version>1.6</version>
        </dependency>
    
        <!-- <dependency> 
            <groupId>org.apache.poi</groupId> 
            <artifactId>poi</artifactId> 
            <version>3.11</version> 
        </dependency>
        <dependency> 
            <groupId>org.apache.poi</groupId> 
            <artifactId>poi-ooxml</artifactId> 
            <version>3.11</version> 
        </dependency>
        <dependency> 
            <groupId>org.apache.poi</groupId> 
            <artifactId>poi-ooxml-schemas</artifactId> 
            <version>3.11</version> 
        </dependency> -->
    
        <dependency转帖:maven maven项目构建ssh工程(父工程与子模块的拆分与聚合)

jenkins多模块工程怎么构建

使用 IDEA和Maven 整合SSH框架

SSH+SpringBoot项目构建

SSH项目开发里用maven的好处

使用Maven构建SSH