构建 struts2 spring3 mybatis 的maven项目 构建 pom.xml

Posted jethypc

tags:

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

学习maven项目时 搭建个ssm项目 算是给自己留个备份吧

 

环境说明:

MyEclipse10  

Maven   3.2.3

框架:

struts2    2.3.24.1

spring3    3.0.5.RELEASE

mybatis    3.2.2

数据库:

mysql 5.7

 

<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>MavenDemo</groupId>
  <artifactId>MavenDemo</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name/>
  <description/>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    
    <struts.version>2.3.24.1</struts.version>
    <struts.javassist.version>3.12.1.GA</struts.javassist.version>
    <spring.version>3.0.5.RELEASE</spring.version>
    <mybatis.version>3.2.2</mybatis.version>
    <mybatis.spring.version>1.2.1</mybatis.spring.version>
    <mysql.version>5.1.37</mysql.version>
    <slf4j.version>1.7.5</slf4j.version>
    <aspectj.version>1.6.10</aspectj.version>
  </properties>
  <dependencies>
  
    <!-- struts2 依赖包 -->
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-core</artifactId>
        <version>${struts.version}</version>
    </dependency>
    <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>${struts.javassist.version}</version>
    </dependency>
        <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-spring-plugin</artifactId>
        <version>${struts.version}</version>
    </dependency>
    <!-- spring 依赖包 -->    
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</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-tx</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-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-oxm</artifactId>
           <version>${spring.version}</version>
       </dependency>
       <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-web</artifactId>
           <version>${spring.version}</version>
       </dependency>
    <!-- mybatis 依赖包 -->
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis</artifactId>
        <version>${mybatis.version}</version>
    </dependency>
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis-spring</artifactId>
        <version>${mybatis.spring.version}</version>
    </dependency>
    <!-- myql 依赖包 -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>${mysql.version}</version>
    </dependency>
    
    <!-- aspectj 依赖包 -->
     
    <dependency>  
        <groupId>org.aspectj</groupId>  
        <artifactId>aspectjrt</artifactId>  
        <version>${aspectj.version}</version>  
    </dependency>
     <!-- 
    <dependency>  
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>${aspectj.version}</version>  
    </dependency>
     -->
    <!-- slf4j 依赖包 -->
    <dependency>  
        <groupId>org.slf4j</groupId>  
        <artifactId>slf4j-log4j12</artifactId>  
        <version>${slf4j.version}</version>  
    </dependency> 
    <!-- 测试 -->
       <!-- 
    <dependency>  
        <groupId>junit</groupId>  
        <artifactId>junit</artifactId>  
        <version>${junit.version}</version>  
    </dependency>  
     -->
        
  </dependencies>
  <build>
      <!-- 源文件夹位置定义 -->
    <sourceDirectory>${basedir}/src</sourceDirectory>
    <!-- 输出文件夹位置定义 -->
    <outputDirectory>${basedir}/WebRoot/WEB-INF/classes</outputDirectory>
    <!-- 资源文件位置定义 -->
    <resources>
      <resource>
        <directory>${basedir}/src</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <!-- 打包插件 -->
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webappDirectory>${basedir}/WebRoot</webappDirectory>
          <warSourceDirectory>${basedir}/WebRoot</warSourceDirectory>
        </configuration>
      </plugin>
      <!-- 编译插件 -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

 

以上是关于构建 struts2 spring3 mybatis 的maven项目 构建 pom.xml的主要内容,如果未能解决你的问题,请参考以下文章

Struts2+Spring3+MyBatis3整合以及Spring注解开发

Spring3.2+mybatis3.2+Struts2.3整合配置文件大全

Maven搭建Struts2+Spring3+Hibernate4框架

SSH网站构建基本方法

spring3.2+mybatis3.2+maven整合

Struts2.3.4.1+Spring3.2.3+Hibernate4.1.9整合