程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> JAVA綜合教程 >> 構建 struts2 spring3 mybatis 的maven項目 構建 pom.xml,struts2maven

構建 struts2 spring3 mybatis 的maven項目 構建 pom.xml,struts2maven

編輯:JAVA綜合教程

構建 struts2 spring3 mybatis 的maven項目 構建 pom.xml,struts2maven


學習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>

 

pom下載

 

然後是這個基本ssm項目 但基本只是個空的項目 只是簡單的測試了下流程通了

項目下載

 

恩 打算過一陣兒再實踐下shiro  好了 收工 

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved