1,建立工程以后,就可以先运行pom.xml可以看到成功,并产生一个空的war包。 如何建工程?请见 spring实战之一maven工程建立

    2, 打开编辑pom.xml

    在根节点project下,dependencies 节点前添加以下内容

    <modelVersion>4.0.0</modelVersion>
      <groupId>blog</groupId>
      <artifactId>com.xuahua</artifactId>
      <packaging>war</packaging>
      <version>0.0.1-SNAPSHOT</version>
      <name>com.xuahua Maven Webapp</name>
      <url>http://maven.apache.org</url>
      
      <!-- 定义本pom.xml引用版本属性, org.springframework-version,org.hibernate-version,project.build.sourceEncodeing 此名可随便取,必须与下面引用相匹配。 -->
      <properties>
    		<org.springframework-version>4.0.0.RELEASE</org.springframework-version>
    		<org.hibernate-version>4.3.1.Final</org.hibernate-version>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     </properties>
    dependencies 节点内,可添加相关联的包

    <!-- 下面是springframwork 4.xx 引用的包 -->
        <!-- spring 4 -->
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-core</artifactId>
    			<version>${org.springframework-version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-webmvc</artifactId>
    			<version>${org.springframework-version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-context</artifactId>
    			<version>${org.springframework-version}</version>
    			<exclusions>
    				<!-- Exclude Commons Logging in favor of SLF4j -->
    				<exclusion>
    					<groupId>commons-logging</groupId>
    					<artifactId>commons-logging</artifactId>
    				</exclusion>
    			</exclusions>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-orm</artifactId>
    			<version>${org.springframework-version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-expression</artifactId>
    			<version>${org.springframework-version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-context-support</artifactId>
    			<version>${org.springframework-version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-web</artifactId>
    			<version>${org.springframework-version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-aop</artifactId>
    			<version>${org.springframework-version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-beans</artifactId>
    			<version>${org.springframework-version}</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-tx</artifactId>
    			<version>${org.springframework-version}</version>
    		</dependency>
       	 <dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-test</artifactId>
    			<version>${org.springframework-version}</version>
    		</dependency>

    Apache Commons 基础组件


    <dependency>
    			<groupId>commons-lang</groupId>
    			<artifactId>commons-lang</artifactId>
    			<version>2.6</version>
    		</dependency>
    		<dependency>
    			<groupId>commons-collections</groupId>
    			<artifactId>commons-collections</artifactId>
    			<version>3.2.1</version>
    		</dependency>
    		<dependency>
    			<groupId>commons-beanutils</groupId>
    			<artifactId>commons-beanutils</artifactId>
    			<version>1.8.3</version>
    		</dependency>
    
    		<dependency>
    			<groupId>commons-fileupload</groupId>
    			<artifactId>commons-fileupload</artifactId>
    			<version>1.3</version>
    		</dependency>
    		<dependency>
    			<groupId>commons-codec</groupId>
    			<artifactId>commons-codec</artifactId>
    			<version>1.8</version>
    		</dependency>
    		<dependency>
    			<groupId>commons-configuration</groupId>
    			<artifactId>commons-configuration</artifactId>
    			<version>1.10</version>
    		</dependency>
    		
    		<dependency>
    			<groupId>org.apache.httpcomponents</groupId>
    			<artifactId>httpclient</artifactId>
    			<version>4.3.6</version>
    		</dependency>
    返回json串时,使用到的处理相关包 Jackson 

    <dependency>
    			<groupId>com.fasterxml.jackson.core</groupId>
    			<artifactId>jackson-annotations</artifactId>
    			<version>2.5.1</version>
    		</dependency>
    		<dependency>
    			<groupId>com.fasterxml.jackson.core</groupId>
    			<artifactId>jackson-core</artifactId>
    			<version>2.5.1</version>
    		</dependency>
    		<dependency>
    			<groupId>com.fasterxml.jackson.core</groupId>
    			<artifactId>jackson-databind</artifactId>
    			<version>2.5.1</version>
    		</dependency>
    		<dependency>
    			<groupId>org.codehaus.jackson</groupId>
    			<artifactId>jackson-mapper-asl</artifactId>
    			<version>1.9.13</version>
    		</dependency>
    slf4j 日志文件框架使用的jar包

    <dependency>
    			<groupId>org.slf4j</groupId>
    			<artifactId>slf4j-log4j12</artifactId>
    			<version>1.7.2</version>
    		</dependency>
    mysql driver 数据库驱动包

    	<dependency>
    			<groupId>mysql</groupId>
    			<artifactId>mysql-connector-java</artifactId>
    			<version>5.1.15</version>
    		</dependency>
     数据库联接池使用的

    <!-- c3p0 datasource  数据库联接池使用的,此处是c3p0-->
    		<dependency>
    			<groupId>c3p0</groupId>
    			<artifactId>c3p0</artifactId>
    			<version>0.9.1.2</version>
    		</dependency>
    		<!-- druid 联接池,同时也提供内部默认的监控,个人推荐 -->
    		 <dependency>
    			<groupId>com.alibaba</groupId>
    			<artifactId>druid</artifactId>
    			<version>1.0.23</version>
    		</dependency>
    		<!-- dbcp使用的默认联接池  配合 commons-pool 使用-->
    		<dependency>
    			<groupId>commons-dbcp</groupId>
    			<artifactId>commons-dbcp</artifactId>
    			<version>1.4</version>
    		</dependency>
    		<dependency>
    			<groupId>commons-pool</groupId>
    			<artifactId>commons-pool</artifactId>
    			<version>1.5.4</version>
    		</dependency>
    		
    		
    		<!-- 中间件 ibatis -->
    		<dependency>
    			<groupId>org.apache.ibatis</groupId>
    			<artifactId>ibatis-core</artifactId>
    			<version>3.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.mybatis</groupId>
    			<artifactId>mybatis-spring</artifactId>
    			<version>1.2.3</version>
    		</dependency>
     hiberante 4

    <dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-core</artifactId>
    			<version>${org.hibernate-version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-validator</artifactId>
    			<version>${org.hibernate-version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.javassist</groupId>
    			<artifactId>javassist</artifactId>
    			<version>3.18.1-GA</version>
    		</dependency>
    		<!-- http-client -->
    		<dependency>
    			<groupId>commons-httpclient</groupId>
    			<artifactId>commons-httpclient</artifactId>
    			<version>3.1</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.httpcomponents</groupId>
    			<artifactId>httpcore</artifactId>
    			<version>4.3.3</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.httpcomponents</groupId>
    			<artifactId>httpmime</artifactId>
    			<version>4.3.3</version>
    		</dependency>
    		
    其他可以用到的

    <!-- AspectJ -->
    		<dependency>
    			<groupId>org.aspectj</groupId>
    			<artifactId>aspectjrt</artifactId>
    			<version>1.7.4</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.aspectj</groupId>
    			<artifactId>aspectjweaver</artifactId>
    			<version>1.7.4</version>
    		</dependency>
    		<!-- json-lib -->
    		<dependency>
    			<groupId>net.sf.json-lib</groupId>
    			<artifactId>json-lib</artifactId>
    			<version>2.4</version>
    			<classifier>jdk15</classifier>
    		</dependency>
    		<dependency>
    			<groupId>com.alibaba</groupId>
    			<artifactId>fastjson</artifactId>
    			<version>1.2.7</version>
    		</dependency>
    		<!-- memcached -->
    		<dependency>
    			<groupId>com.whalin</groupId>
    			<artifactId>Memcached-Java-Client</artifactId>
    			<version>3.0.2</version>
    		</dependency>
    		<dependency>
    			<groupId>com.google.code.maven-play-plugin.spy</groupId>
    			<artifactId>spymemcached</artifactId>
    			<version>2.6</version>
    		</dependency>
    		
    		<!-- servlet3 -->
    		<dependency>
    			<groupId>javax.servlet</groupId>
    			<artifactId>javax.servlet-api</artifactId>
    			<version>3.0.1</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>javax.servlet</groupId>
    			<artifactId>servlet-api</artifactId>
    			<version>2.3</version>
    			<scope>provided</scope>
    		</dependency>

    完整的文件可以下载地址 http://file.xuahua.com/images/blog/2016/0728/pom.xml

    联系QQ:343886028 --加QQ群 145315854