该pom中包含了一些我认为会需要的东西,并且加了注释。可以根据需求适当删减。

包含了spring-mvc , junit,hibernate验证,json,apache-commons组件

还有 complier,cargo,surefire,jetty插件

 <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"> <!-- 下面7个设置就不用复制了,每个项目都不一样的 -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.suyin</groupId>
<artifactId>weixin</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>weixin Maven Webapp</name>
<url>http://maven.apache.org</url> <properties>
<spring-version>4.0.6.RELEASE</spring-version>
<junit-version>4.9</junit-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <!-- 其实吧,如果你在ecplise中查看这个pom的继承树,你会发现好多都是重复的,完全可以不写:比如 spring-core,任何一个spring组件 -->
<!-- 都依赖这个组件,并且也声明这个依赖啊,那么其实我们在这个pom中根本不必显式声明依赖 spring-core,Maven会自动帮我们处理这种依赖传递的。 -->
<!-- 可是显式声明不是显得清楚明白一点么 -->
<dependencies>
<!--这个包要有,要不然在Controller中连HttpServletRequest都没法依赖了,不过在实际环境中容器会提供所以scope是provided -->
<!-- 当然如果不是web项目那就肯定不需要了^_^ -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency> <!-- 这个包未必要有,在jsp中,如果要写 out.print("xxx"); 那么如果没有这个包会发现key assistant根本没用了 -->
<!-- 因为 out就是 javax.servlet.jsp.JspWriter的对象,而这个类就在这个包里面 -->
<!-- 当然如果压根就没想过这么写,也可以不要这个组件 -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2.1-b03</version>
<scope>provided</scope>
</dependency> <!-- spring 核心组件 开始 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</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-context-support</artifactId>
<version>${spring-version}</version>
</dependency> <!-- spring expression是spring扩展el表达式的一个组件(SpEL) -->
<!-- 一个最简单的应用使用cache时描述生成key的策略 -->
<!-- 如有注解:@Cacheable(value="peoplecache",key="#root.method.name") -->
<!-- 如果不需要用SpEL,就不要加这个组件了 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring-version}</version>
</dependency>
<!-- spring 核心组件结束 --> <!-- spring web组件开始(看名字就知道要使用spring mvc的必须组件了) -->
<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>
<!-- spring web组件结束 --> <!-- aop(尽管不是十分清楚,但是如果要在xml中配置事务(声明性事务配置),我觉得就必须有这个组件;) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring-version}</version>
</dependency> <!-- 这里提供了对于AspectJ的整合,其实AspectJ是与spring-aop差不多但是可能功能多一点的框架 -->
<!-- 一般情况下spring-aop就足够了,所以一般情况下也不需要这个组件 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring-version}</version>
</dependency> <!-- spring数据层,没啥说的,当然如果用其他的jdbc那就可以不要这个组件了 -->
<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> <!-- 提过对junit和testng的支持,测试肯定要的 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring-version}</version>
<scope>test</scope>
</dependency> <!-- spring 不常用组件 开始 -->
<!-- 估计随着HTML5的发展,这个组件会变得常用 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>${spring-version}</version>
</dependency> <!-- 这个组件提供对STOMP协议的支持,说实话从来没用过这个协议 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>${spring-version}</version>
</dependency> <!-- 提供了对各个容器的扩展,似乎并不太需要 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>${spring-version}</version>
</dependency>
<!-- 看名字就是提供对orm框架( JPA, JDO, and Hibernate)的支持 -->
<!-- 如果用Mybatis,那就不要这个组件了 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring-version}</version>
</dependency>
<!-- 看名字就是xml与object的mapping了 。就是把xml和pojo这件来回转换。 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring-version}</version>
</dependency>
<!-- 看名字就是提供对jms的支持了 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring-version}</version>
</dependency>
<!-- 提供了基于portlet的mvc实现(By the way,我目前接触后台的mvc都是基于servlet或者filter实现的,所有大部分时候是不要这个东西的) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>${spring-version}</version>
</dependency>
<!-- spring 不常用组件结束 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency> <!-- 没用过json,好意思说是程序员! -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency> <!-- 在spring-text组件中测试测试返回的json是什么,要下面两个包 -->
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>0.9.1</version>
<scope>test</scope>
</dependency> <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version>
</dependency> <!-- mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.3</version>
</dependency> <!-- 这两个包是jstl表达式需要的包,jstl就是常用的 c:foreach;c:if什么的 -->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- 使用hibernate进行数据校验需要下面这个组件,其实这个组件还依赖jboss-logging,validation-api等, -->
<!-- 不过maven会帮我们自动处理这个依赖的。 -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.1.3.Final</version>
</dependency> <!-- 不是说spring整合ehcache比较好吗?为什么不用呢 -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.6.0</version>
</dependency> <!-- 下面是常用的apache的 commons-xxx -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</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.9.2</version>
</dependency> </dependencies> <build>
<finalName>weixin</finalName>
<plugins>
<!-- 这个plugin 保证maven编译用的是java 1.7 -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- 这个plugin配置保证在测试时以Abstract开头的类不进行测试 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<excludes>
<exclude>**/**/Abstract*.java</exclude>
</excludes>
</configuration>
</plugin> <!-- 下面这个plugin是jetty容器插件 -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 这是cargo插件,不知道cargo是什么!好吧,cargo可以实现自动化部署 -->
<!-- 下面的配置就是把war包自动发送到192.168.128.137:8080的tomcat中 -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.9</version>
<configuration>
<container>
<containerId>tomcat7x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.uri>http://192.168.128.137:8080/manager/text</cargo.remote.uri>
<cargo.remote.username>admin</cargo.remote.username>
<cargo.remote.password>admin</cargo.remote.password>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build> </project>

Maven的pom实例的更多相关文章

  1. Maven的POM.xml配置大全

    <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://mave ...

  2. 史上最全的maven的pom.xml文件详解

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  3. Maven的pom.xml 配置详解

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  4. Maven项目pom.xml文件详解

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  5. 【maven】 pom.xml详解

    pom.xml详解 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www ...

  6. Maven系列--pom.xml 配置详解

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  7. Maven配置文件Pom.xml详解

    <project xmlns="http://maven.apache.org/POM/4.0.0 "      xmlns:xsi="http://www.w3. ...

  8. Maven之pom.xml 配置详解

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  9. Maven的pom.xml配置文件详解

    Maven简述 Maven项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的软件项目管理工具. Maven 除了以程序构建能力为特色之外,还提供高级项目管理工具.由于 Mav ...

随机推荐

  1. Hive2.0的新特性介绍

  2. python核心编程3-13

    3.13: 添加新功能. 将你上一个问题改造好的readNwriteTextFiles.py 增加一个新功能: 允许用户编辑一个已经存在的文本文件. 你可以使用任何方式,无论是一次编辑一行,还是一次编 ...

  3. tornado源码分析

    初识tornado 首先从经典的helloword案例入手 import tornado.ioloop import tornado.web class MainHandler(tornado.web ...

  4. build-essential软件包

    linux操作系统上面开发程序, 光有了gcc 是不行的 它还需要一个 build-essential软件包 作用是提供编译程序必须软件包的列表信息 也就是说 编译程序有了这个软件包 它才知道 头文件 ...

  5. Django之Form详解

    Django的Form主要具有一下几大功能: 生成HTML标签 验证用户数据(显示错误信息) HTML Form提交保留上次提交数据 初始化页面显示内容 1.创建Form类.View函数处理 from ...

  6. MYSQL函数 Cast和convert的用法详解

    MYSQL Cast函数是非常重要的MYSQL函数,下面就将为您详细介绍MYSQL Cast函数的语法及其使用,希望能让您对MYSQL Cast函数有更多的认识. BINARY     BINARY操 ...

  7. 中美贸易战再次开启,世界两极化进程正在加快形成!..... Copyright: 1688澳洲新闻网 Read more at: https://www.1688.com.au/world/international/2018/06/17/369368/

    中美贸易战再次开启,世界两极化进程正在加快形成! https://www.1688.com.au/world/international/2018/06/17/369368/

  8. css 采集下载

    软件应用范围: 看到喜欢的网页,另存为的话,并不能直接保存css中引用的图片. 那么就有了本软件的用武之地. 亮点:自动匹配文件内的相对路径.css内图片地址值md5保存,用来避免不同文件夹同名文件的 ...

  9. BI入门经典(转载)

    原帖地址:http://blog.csdn.net/sgtzzc/archive/2009/10/10/4649770.aspx [前言] 昨天论坛的SQL Server大版新增了一个BI板块,大家讨 ...

  10. elasticsearch的store属性跟_source字段——如果你的文档长度很长,存储了_source,从_source中获取field的代价很大,你可以显式的将某些field的store属性设置为yes,否则设置为no

    转自:http://kangrui.iteye.com/blog/2262860 众所周知_source字段存储的是索引的原始内容,那store属性的设置是为何呢?es为什么要把store的默认取值设 ...