Maven的pom实例
该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实例的更多相关文章
- Maven的POM.xml配置大全
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://mave ...
- 史上最全的maven的pom.xml文件详解
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- Maven的pom.xml 配置详解
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- Maven项目pom.xml文件详解
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- 【maven】 pom.xml详解
pom.xml详解 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www ...
- Maven系列--pom.xml 配置详解
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- Maven配置文件Pom.xml详解
<project xmlns="http://maven.apache.org/POM/4.0.0 " xmlns:xsi="http://www.w3. ...
- Maven之pom.xml 配置详解
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- Maven的pom.xml配置文件详解
Maven简述 Maven项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的软件项目管理工具. Maven 除了以程序构建能力为特色之外,还提供高级项目管理工具.由于 Mav ...
随机推荐
- 【leetcode刷题笔记】Linked List Cycle
Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using ext ...
- sql优化,索引学习
- 大话设计模式--解释器模式 interpreter -- C++实现实例
1. 解释器模式: 给定一个语言,定义它的文法的一种表示 并 定义一个解释器,这个解释器使用该表示文法 来解释语言中的句子. 如果一种特定类型的问题发生的频率很高,那么可能就值得将该问题的各个实例表述 ...
- 红米.USB安装_无法打开
1.必须有 SIM卡,才能打开 USB安装 红米1s(miui8.5)就是这样 2. 3. 4. 5.
- java:类集回顾
1.类集设置的主要目的:动态的对象数组 2.类集中有以下几个接口: Collection:是存放单值的最大父接口 |- List接口:里面的内容是允许重复的 |- ArrayList, Vector, ...
- SWFObject是什么
一:简介: SWFObject是一个用于在HTML中方便插入Adobe Flash媒体资源(*.swf文件)的独立.敏捷的JavaScript模块.该模块中的JavaScript脚本能够自动检测PC. ...
- Java中的参数传值方式
本文转载自 https://blog.csdn.net/SEU_Calvin/article/details/70089977 1. 你觉得下面程序会输出什么 public static void ...
- 【leetcode刷题笔记】Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left ...
- 基于v4l2 ffmpeg x264的视频远程监控(附上编译好的库文件)
说明:主要是基于ghostyu网友整理的< arm mini2440 基于v4l2 ffmpeg x264的视频远程监控>.自己做了一遍,遇到不少问题,就整理记录下来. 1.平台 硬件:a ...
- bootstrap 左右框多项选择示例
bootstrap 左右选择框,左边框是未选项,右边框是已选择项,提供单选,全选按钮,以及取消已选项,如图示: