你的位置:首页 > Java教程

[Java教程]构建 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 ="http://maven.apache.org/POM/4.0.0" ="http://www.w3.org/2001/ 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>

 

pom下载

 

然后是这个基本ssm项目 但基本只是个空的项目 只是简单的测试了下流程通了

项目下载

 

恩 打算过一阵儿再实践下shiro  好了 收工