Maven + Spring4

Posted ParamousGIS

tags:

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

 

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.xxxx</groupId>
  <artifactId>xxxx</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>xxxx</name>
  <url>http://maven.apache.org</url>
  <properties>
    <!-- database -->
    <jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>        
    <jdbc.host>127.0.0.1</jdbc.host>
    <jdbc.port>3306</jdbc.port>
    <jdbc.databaseName>xxxx</jdbc.databaseName>
    <jdbc.username>root</jdbc.username>
    <jdbc.password>root</jdbc.password>
    <!-- version -->
    <spring.version>4.1.6.RELEASE</spring.version>
    <spring.security.version>4.0.1.RELEASE</spring.security.version>
    <java.version>1.8</java.version>
    <mysql.connector.verison>5.1.6</mysql.connector.verison>
    <tomcat.plugin.version>2.2</tomcat.plugin.version>
    <!-- Encoding -->  
    <encoding>UTF8</encoding>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>        
    <maven.compiler.encoding>UTF-8</maven.compiler.encoding>        
  </properties>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <!-- spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
        <exclusions>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</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-web</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
    <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>${spring.security.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>${spring.security.version}</version>
    </dependency>
    <dependency>
          <groupId>org.springframework.security</groupId>
          <artifactId>spring-security-taglibs</artifactId>
          <version>${spring.security.version}</version>
    </dependency>
    <!-- 日志 -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>1.5.8</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.5.8</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.5.8</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
    </dependency>
    
    <!-- JSP JSTL -->
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>2.3.2-b01</version>
        <scope>provided</scope>
    </dependency>

    <!--     <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency> -->

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
         <scope>provided</scope>
    </dependency>
    
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
        
    <dependency>  
        <groupId>com.fasterxml.jackson.core</groupId>  
        <artifactId>jackson-databind</artifactId>  
        <version>2.5.3</version>
    </dependency>
    
    <dependency>
        <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-xml</artifactId>
        <version>2.5.3</version>
    </dependency>
    <!-- 数据库 -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>${mysql.connector.verison}</version>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
        <id>io.spring.repo.maven.release</id>
        <url>http://repo.spring.io/release/</url>
        <snapshots><enabled>false</enabled></snapshots>
    </repository>
    <repository>
        <id>mvnrepository</id>
        <url>http://mvnrepository.com/</url>
        <snapshots><enabled>false</enabled></snapshots>
    </repository>
    <repository>
        <id>mvnCenterRepository</id>
        <url>http://repo1.maven.org/maven2/</url>
        <snapshots><enabled>false</enabled></snapshots>
    </repository>
    <!-- <repository>
        <id>oschina</id>
        <url>http://maven.oschina.net/content/repositories/central/</url>
        <snapshots><enabled>false</enabled></snapshots>
    </repository> -->    
  </repositories>
  <build>
    <finalName>smfs</finalName>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>**/*.properties</include>
            </includes>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <excludes>
                <exclude>**/*.properties</exclude>
            </excludes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.7</version>
            <configuration>  
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.10</version>
            <configuration>
                <wtpversion>2.0</wtpversion>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </configuration>
        </plugin>
        <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>${tomcat.plugin.version}</version>
            <configuration>
                <port>9090</port>
                <path>/xxxxx</path>
                <uriEncoding>UTF-8</uriEncoding>
                <finalName>xxxxx</finalName>
                <server>tomcat7</server>
            </configuration>
        </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
            <source>1.8</source>  
            <target>1.8</target>
            <showWarnings>true</showWarnings> 
            <encoding>UTF-8</encoding>            
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

以上是关于Maven + Spring4的主要内容,如果未能解决你的问题,请参考以下文章

Spring4 mvc+maven 框架搭建

cxf3.1+spring4+maven启动报错

Spring4-通过Maven构建Spring+JDBC

MyBatis学习总结——Mybatis3.x与Spring4.x整合

MyBatis3.x与Spring4.x整合

activemq5.11整合spring4.2.3