该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. 创建图形用户界面GUI和事件监听机制的简单实现(java)

    创建图形化界面 1.创建Frame窗体      2.对窗体进行基本设置 比如:大小.位置.布局      3.定义组件      4.将组建通过窗体添加到窗体中 5.让窗体显示,通过setVisib ...

  2. [算法]去掉字符串中连续出现的k个0子串

    题目: 给定一个字符串str和一个整数k,如果str中正好有k个‘0’字符出现时,把k个连续的‘0’字符去除,返回处理后的字符串. 举例: str=”A00B”,k=2,返回“AB” str=”A00 ...

  3. linux学习-文件打包与压缩

  4. window.showModalDialog()之返回值

    window.showModalDialog的基本用法 showModalDialog() (IE 4+ 支持) showModelessDialog() (IE 5+ 支持) window.show ...

  5. html网页小图标

    <link rel="shortcut icon" href="../image/favicon.ico"/>

  6. qt和makefile学习网址

    http://blog.51cto.com/zt/20/1/   ---qt学习网站 http://www.chinaunix.net/old_jh/23/408225.html  [精华] 跟我一起 ...

  7. L105

    A pill could soon radio signals from inside your gut to help doctors diagnose diseases from ulcers t ...

  8. Uva 10820 Send a Table(欧拉函数)

    对每个n,答案就是(phi[2]+phi[3]+...+phi[n])*2+1,简单的欧拉函数应用. #include<iostream> #include<cstdio> # ...

  9. STL defalloc.h

    defalloc.h . // Filename: defalloc.h . . // Comment By: 凝霜 . // E-mail: mdl2009@vip.qq.com . // Blog ...

  10. 每天一个linux命令(10):touch命令

    版权声明更新:2017-05-14博主:LuckyAlan联系:liuwenvip163@163.com声明:吃水不忘挖井人,转载请注明出处! 1 文章介绍 本文介绍了Linux下面的mv命令. 2. ...