JEEWEB的Maven的配置文件pom.xml

简介:

什么是POM?

POM是项目对象模型(Project Object Model)的简称,它是Maven项目中的文件,使用XML表示,名称叫做pom.xml。在Maven中,当谈到Project的时候,不仅仅是一堆包含代码的文件。一个Project往往包含一个配置文件,包括了与开发者有关的,缺陷跟踪系统,组织与许可,项目的URL,项目依赖,以及其他。它包含了所有与这个项目相关的东西。事实上,在Maven世界中,project可以什么都没有,甚至没有代码,但是必须包含pom.xml文件。

概览

下面是一个POM项目中的pom.xml文件中包含的元素。注意,其中的modelVersion是4.0.0,这是当前仅有的可以被Maven2&3同时支持的POM版本,它是必须的。

  1. <project xmlns="http://maven.apache.org/POM/4.0.0"
  2.          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3.          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
  4.             http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5.     <modelVersion>4.0.0</modelVersion>
  6.     
  7.     <!-- 基本设置 -->
  8.     <groupId>...</groupId>
  9.     <artifactId>...</artifactId>
  10.     <version>...</version>
  11.     <packaging>...</packaging>
  12.     <dependencies>...</dependencies>
  13.     <parent>...</parent>
  14.     <dependencyManagement>...</dependencyManagement>
  15.     <modules>...</modules>
  16.     <properties>...</properties>
  17.     
  18.     <!-- 构建过程的设置 -->
  19.     <build>...</build>
  20.     <reporting>...</reporting>
  21.     
  22.     <!-- 项目信息设置 -->
  23.     <name>...</name>
  24.     <description>...</description>
  25.     <url>...</url>
  26.     <inceptionYear>...</inceptionYear>
  27.     <licenses>...</licenses>
  28.     <organization>...</organization>
  29.     <developers>...</developers>
  30.     <contributors>...</contributors>
  31.     
  32.     <!-- 环境设置 -->
  33.     <issueManagement>...</issueManagement>
  34.     <ciManagement>...</ciManagement>
  35.     <mailingLists>...</mailingLists>
  36.     <scm>...</scm>
  37.     <prerequisites>...</prerequisites>
  38.     <repositories>...</repositories>
  39.     <pluginRepositories>...</pluginRepositories>
  40.     <distributionManagement>...</distributionManagement>
  41.     <profiles>...</profiles>
  42. </project>
复制代码


基本的设置:

POM包含了一个project所需要的所有信息,当然也就包含了构建过程中所需要的插件的配置信息,事实上,这里申明了"who","what",和"where",然而构建生命周期(build lifecycle)s中说的是"when"和"how"。这并不是说POM并能影响生命周期的过程-事实上它可以。例如,配置一个可以嵌入ant任务到POM的mavem-antrun-plugin。它基本上就是一个声明。就像build.xml告诉ant当运行时它该做什么一样,一个POM申明了它自己的配置。如果外力迫使生命周期跳过了ant插件的执行,这并不影响那些已经执行过的插件产生的效果。这一点和build.xml不一样。

Maven坐标

上面的POM定义的是Maven2&3都承认的最小部分。groupId:artifactId:version是必须的字段(尽管在继承中groupId和version不需要明确指出)。这三个字段就像地址和邮戳,它标记了仓库中的特定位置,就像Maven projects的坐标系统一样。

JEEWEB详细配置如下:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3.          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4.          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5.     <modelVersion>4.0.0</modelVersion>
  6.     
  7.         <groupId>html580.jeeweb</groupId>
  8.         <artifactId>jeeweb</artifactId>
  9.         <packaging>war</packaging>
  10.         <version>1.0-SNAPSHOT</version>
  11.         <name>jeeweb</name>
  12.         <url>https://github.com/html580/JEEWEB</url>
  13.         <organization>
  14.                 <name>jeeweb</name>
  15.                 <url>http://bbs.html580.com/forum.php?gid=47</url>
  16.         </organization>
  17.   
  18.     <!-- 设定除中央仓库(repo1.maven.org/maven2/)外的其他仓库,按设定顺序进行查找. -->
  19.         <repositories>
  20.                 <!-- 如有Nexus私服, 取消注释并指向正确的服务器地址.
  21.                 <repository>
  22.                         <id>nexus-repos</id>
  23.                         <name>Team Nexus Repository</name>
  24.                         <url>http://localhost:8081/nexus/content/groups/public</url> 
  25.                 </repository>-->
  26.                 <repository>
  27.             <id>apache-repo</id>
  28.             <name>apache Repository</name>
  29.             <url>https://repository.apache.org/content/groups/public/</url>
  30.         </repository>
  31.         <repository>
  32.             <id>java-repo</id>
  33.             <name>java Repository</name>
  34.             <url>http://download.java.net/maven/2/</url>
  35.         </repository>
  36.         <repository>
  37.             <id>springsource-repo</id>
  38.             <name>SpringSource Repository</name>
  39.             <url>http://repo.spring.io/release/</url>
  40.         </repository>
  41.         <repository>
  42.             <id>springsource-repo-snapshot</id>
  43.             <name>SpringSource Repository</name>
  44.             <url>http://repo.spring.io/snapshot/</url>
  45.         </repository>
  46.         <repository>
  47.             <id>cloudhopper</id>
  48.             <name>Repository for Cloudhopper</name>
  49.             <url>http://maven.cloudhopper.com/repos/third-party/</url>
  50.         </repository>
  51.         <repository>
  52.             <id>jboss-repo-releases</id>
  53.             <name>Jboss Repository</name>
  54.             <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
  55.         </repository>
  56.         <repository>
  57.             <id>central</id>
  58.             <name>Maven Repository Switchboard</name>
  59.             <layout>default</layout>
  60.             <url>http://repo.maven.apache.org/maven2</url>
  61.         </repository>
  62.         <repository>
  63.             <id>maven-repo1</id>
  64.             <name>maven-repo1</name>
  65.             <layout>default</layout>
  66.             <url>http://repo1.maven.org/maven2/</url>
  67.         </repository>
  68.         <repository>
  69.             <id>sourceforge-releases</id>
  70.             <name>Sourceforge Releases</name>
  71.             <url>https://oss.sonatype.org/content/repositories/sourceforge-releases/</url>
  72.         </repository>
  73.    </repositories>
  74.         
  75.         
  76.    <!-- 开发人员信息 -->
  77.     <developers>
  78.         <developer>
  79.             <name>dengzhifeng</name>
  80.             <email>[email protected]</email>
  81.             <url>http://www.html580.com</url>
  82.             <roles>
  83.                 <role>software engineer</role>
  84.             </roles>
  85.             <timezone>8</timezone>
  86.         </developer>
  87.     </developers>
  88.     <!--许可证 -->
  89.     <licenses>
  90.         <license>
  91.             <name>Apache License, Version 2.0</name>
  92.             <url>http://www.apache.org/licenses/LICENSE-2.0</url>
  93.         </license>
  94.     </licenses>
  95.     
  96.     <!-- 问题反馈信息 -->
  97.     <issueManagement>
  98.         <system>JEEWEB</system>
  99.         <url>http://bbs.html580.com/forum.php?gid=47</url>
  100.     </issueManagement>
  101.     
  102.     
  103.     <properties>
  104.         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  105.         <!-- version setting -->
  106.                 <asm.version>4.2</asm.version>
  107.         <cglib.version>3.1</cglib.version>
  108.         <commons-lang3.version>3.1</commons-lang3.version>
  109.         <common-collections4.version>4.0</common-collections4.version>
  110.         <commons-io.version>2.4</commons-io.version>
  111.         <guava.version>15.0</guava.version>
  112.         <common.fileupload.version>1.3</common.fileupload.version>
  113.         <common.compress.version>1.6</common.compress.version>
  114.         <ant.version>1.9.2</ant.version>
  115.         <junit.version>4.11</junit.version>
  116.         <mockito.version>1.9.5</mockito.version>
  117.         <powermock.version>1.5.2</powermock.version>
  118.         <h2.version>1.3.174</h2.version>
  119.         <jetty.version>8.1.8.v20121106</jetty.version>
  120.         <servlet.version>3.0.1</servlet.version>
  121.         <jsp.version>2.2</jsp.version>
  122.         <jstl.version>1.2</jstl.version>
  123.         <standard.version>1.1.2</standard.version>
  124.         <aspectj.version>1.7.4</aspectj.version>
  125.         <spring.version>4.0.0.RELEASE</spring.version>
  126.         <spring.data.jpa.version>1.4.1.RELEASE</spring.data.jpa.version>
  127.         <hibernate.core.version>4.3.0.Final</hibernate.core.version>
  128.         <hibernate.ehcache.version>4.3.0.Final</hibernate.ehcache.version>
  129.         <hibernate.commons.annotaions.version>4.0.4.Final</hibernate.commons.annotaions.version>
  130.         <hibernate.validator.version>5.0.2.Final</hibernate.validator.version>
  131.         <javassist.version>3.18.0-GA</javassist.version>
  132.         <ehcache.core.version>2.6.6</ehcache.core.version>
  133.         <shiro.version>1.2.2</shiro.version>
  134.         <slf4j.version>1.7.5</slf4j.version>
  135.         <logback.version>1.0.13</logback.version>
  136.         <druid.version>0.2.23</druid.version>
  137.         <fastjson.version>1.1.34</fastjson.version>
  138.         <httpclient.version>4.3.1</httpclient.version>
  139.         <dom4j.version>1.6.1</dom4j.version>
  140.         <joda-time.version>2.3</joda-time.version>
  141.         <prettytime.version>3.2.3.Final</prettytime.version>
  142.         <jcaptcha.version>2.0-alpha-1</jcaptcha.version>
  143.         <jsoup.version>1.7.3</jsoup.version>
  144.                 
  145.                 <!-- mysql driver setting -->
  146.                 <jdbc.driver.groupId>mysql</jdbc.driver.groupId>
  147.                 <jdbc.driver.artifactId>mysql-connector-java</jdbc.driver.artifactId>
  148.                 <jdbc.driver.version>5.1.13</jdbc.driver.version>
  149.                 
  150.                 <!-- oracle driver setting
  151.                 <jdbc.driver.groupId>com.oracle</jdbc.driver.groupId>
  152.                 <jdbc.driver.artifactId>ojdbc14</jdbc.driver.artifactId>
  153.                 <jdbc.driver.version>10.2.0.1.0</jdbc.driver.version> -->
  154.                 
  155.                 <!-- mssql driver setting
  156.                 <jdbc.driver.groupId>net.sourceforge.jtds</jdbc.driver.groupId>
  157.                 <jdbc.driver.artifactId>jtds</jdbc.driver.artifactId>
  158.                 <jdbc.driver.version>1.2.4</jdbc.driver.version> -->
  159.             
  160.                 <!-- other setting -->
  161.                 <jdk.version>1.6</jdk.version>
  162.                 <tomcat.version>2.1</tomcat.version>
  163.                 <jetty.version>7.6.10.v20130312</jetty.version>
  164.                 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  165.     </properties>
  166.     
  167.     <!-- 依赖项定义 -->
  168.         <dependencies>
  169.         <!-- 测试相关jar包 -->
  170.         <dependency>
  171.             <groupId>junit</groupId>
  172.             <artifactId>junit</artifactId>
  173.             <version>${junit.version}</version>
  174.             <scope>test</scope>
  175.         </dependency>
  176.         <dependency>
  177.             <groupId>org.mockito</groupId>
  178.             <artifactId>mockito-all</artifactId>
  179.             <version>${mockito.version}</version>
  180.             <scope>test</scope>
  181.         </dependency>
  182.         <dependency>
  183.             <groupId>org.springframework</groupId>
  184.             <artifactId>spring-test</artifactId>
  185.             <version>${spring.version}</version>
  186.         </dependency>
  187.         
  188.         <dependency>
  189.             <groupId> com.h2database</groupId>
  190.             <artifactId>h2</artifactId>
  191.             <version>${h2.version}</version>
  192.             <scope>test</scope>
  193.         </dependency>
  194.         <dependency>
  195.             <groupId>org.eclipse.jetty</groupId>
  196.             <artifactId>jetty-server</artifactId>
  197.             <version>${jetty.version}</version>
  198.             <scope>test</scope>
  199.             <exclusions>
  200.                 <exclusion>
  201.                     <artifactId>javax.servlet</artifactId>
  202.                     <groupId>org.eclipse.jetty.orbit</groupId>
  203.                 </exclusion>
  204.             </exclusions>
  205.         </dependency>
  206.         <!-- cglib asm 相关jar包-->
  207.         <dependency>
  208.             <groupId>cglib</groupId>
  209.             <artifactId>cglib</artifactId>
  210.             <version>${cglib.version}</version>
  211.         </dependency>
  212.         <dependency>
  213.             <groupId>org.ow2.asm</groupId>
  214.             <artifactId>asm</artifactId>
  215.             <version>${asm.version}</version>
  216.         </dependency>
  217.         <!-- utils 相关jar包 -->
  218.         <dependency>
  219.             <groupId>org.apache.commons</groupId>
  220.             <artifactId>commons-lang3</artifactId>
  221.             <version>${commons-lang3.version}</version>
  222.         </dependency>
  223.         <dependency>
  224.             <groupId>org.apache.commons</groupId>
  225.             <artifactId>commons-collections4</artifactId>
  226.             <version>${common-collections4.version}</version>
  227.         </dependency>
  228.         <dependency>
  229.             <groupId>com.google.guava</groupId>
  230.             <artifactId>guava</artifactId>
  231.             <version>${guava.version}</version>
  232.         </dependency>
  233.         <dependency>
  234.             <groupId>commons-io</groupId>
  235.             <artifactId>commons-io</artifactId>
  236.             <version>${commons-io.version}</version>
  237.         </dependency>
  238.         <dependency>
  239.             <groupId>commons-codec</groupId>
  240.             <artifactId>commons-codec</artifactId>
  241.             <version>1.7</version>
  242.         </dependency>
  243.         <dependency>
  244.             <groupId>commons-beanutils</groupId>
  245.             <artifactId>commons-beanutils</artifactId>
  246.             <version>1.8.3</version>
  247.             <exclusions>
  248.                 <exclusion>
  249.                     <groupId>commons-logging</groupId>
  250.                     <artifactId>commons-logging</artifactId>
  251.                 </exclusion>
  252.             </exclusions>
  253.         </dependency>
  254.         <dependency>
  255.             <groupId>commons-fileupload</groupId>
  256.             <artifactId>commons-fileupload</artifactId>
  257.             <version>${common.fileupload.version}</version>
  258.         </dependency>
  259.         <dependency>
  260.             <groupId>org.apache.commons</groupId>
  261.             <artifactId>commons-compress</artifactId>
  262.             <version>${common.compress.version}</version>
  263.         </dependency>
  264.         <dependency>
  265.             <groupId>org.apache.ant</groupId>
  266.             <artifactId>ant</artifactId>
  267.             <version>${ant.version}</version>
  268.             <exclusions>
  269.                 <exclusion>
  270.                     <artifactId>ant-launcher</artifactId>
  271.                     <groupId>org.apache.ant</groupId>
  272.                 </exclusion>
  273.             </exclusions>
  274.         </dependency>
  275.         <!-- data source 相关jar包-->
  276.         <dependency>
  277.             <groupId>com.alibaba</groupId>
  278.             <artifactId>druid</artifactId>
  279.             <version>${druid.version}</version>
  280.         </dependency>
  281.         
  282.         <!-- jdbc driver -->
  283.                 <dependency>
  284.                         <groupId>${jdbc.driver.groupId}</groupId>
  285.                         <artifactId>${jdbc.driver.artifactId}</artifactId>
  286.                         <version>${jdbc.driver.version}</version>
  287.                         <scope>runtime</scope>
  288.                 </dependency>
  289.                 
  290.         <!-- 日志相关jar包 -->
  291.         <dependency>
  292.             <groupId>org.slf4j</groupId>
  293.             <artifactId>slf4j-api</artifactId>
  294.             <version>${slf4j.version}</version>
  295.         </dependency>
  296.         <dependency>
  297.             <groupId>org.slf4j</groupId>
  298.             <artifactId>jcl-over-slf4j</artifactId>
  299.             <version>${slf4j.version}</version>
  300.         </dependency>
  301.         <dependency>
  302.             <groupId>ch.qos.logback</groupId>
  303.             <artifactId>logback-classic</artifactId>
  304.             <version>${logback.version}</version>
  305.         </dependency>
  306.         <!-- web相关jar包 -->
  307.         <dependency>
  308.             <groupId>javax.servlet</groupId>
  309.             <artifactId>javax.servlet-api</artifactId>
  310.             <version>${servlet.version}</version>
  311.             <scope>provided</scope>
  312.         </dependency>
  313.         <dependency>
  314.             <groupId>javax.servlet.jsp</groupId>
  315.             <artifactId>jsp-api</artifactId>
  316.             <version>${jsp.version}</version>
  317.             <scope>provided</scope>
  318.         </dependency>
  319.         <dependency>
  320.             <groupId>taglibs</groupId>
  321.             <artifactId>standard</artifactId>
  322.             <version>${standard.version}</version>
  323.         </dependency>
  324.         <dependency>
  325.             <groupId>javax.servlet</groupId>
  326.             <artifactId>jstl</artifactId>
  327.             <version>${jstl.version}</version>
  328.         </dependency>
  329.         <!-- aspectj相关jar包-->
  330.         <dependency>
  331.             <groupId>org.aspectj</groupId>
  332.             <artifactId>aspectjrt</artifactId>
  333.             <version>${aspectj.version}</version>
  334.         </dependency>
  335.         <dependency>
  336.             <groupId>org.aspectj</groupId>
  337.             <artifactId>aspectjweaver</artifactId>
  338.             <version>${aspectj.version}</version>
  339.         </dependency>
  340.         <!-- spring相关jar包 -->
  341.         <dependency>
  342.             <groupId>org.springframework</groupId>
  343.             <artifactId>spring-context</artifactId>
  344.             <version>${spring.version}</version>
  345.         </dependency>
  346.         <dependency>
  347.             <groupId>org.springframework</groupId>
  348.             <artifactId>spring-context-support</artifactId>
  349.             <version>${spring.version}</version>
  350.         </dependency>
  351.         <dependency>
  352.             <groupId>org.springframework</groupId>
  353.             <artifactId>spring-jdbc</artifactId>
  354.             <version>${spring.version}</version>
  355.         </dependency>
  356.         <dependency>
  357.             <groupId>org.springframework</groupId>
  358.             <artifactId>spring-orm</artifactId>
  359.             <version>${spring.version}</version>
  360.         </dependency>
  361.         <dependency>
  362.             <groupId>org.springframework</groupId>
  363.             <artifactId>spring-tx</artifactId>
  364.             <version>${spring.version}</version>
  365.         </dependency>
  366.         <!-- spring webmvc相关jar包 -->
  367.         <dependency>
  368.             <groupId>org.springframework</groupId>
  369.             <artifactId>spring-webmvc</artifactId>
  370.             <version>${spring.version}</version>
  371.         </dependency>
  372.         <dependency>
  373.             <groupId>org.springframework</groupId>
  374.             <artifactId>spring-web</artifactId>
  375.             <version>${spring.version}</version>
  376.         </dependency>
  377.         <!-- spring jpa -->
  378.         <dependency>
  379.             <groupId>org.springframework.data</groupId>
  380.             <artifactId>spring-data-jpa</artifactId>
  381.             <version>${spring.data.jpa.version}</version>
  382.             <exclusions>
  383.                 <exclusion>
  384.                     <artifactId>jcl-over-slf4j</artifactId>
  385.                     <groupId>org.slf4j</groupId>
  386.                 </exclusion>
  387.             </exclusions>
  388.         </dependency>
  389.         <!-- hibernate相关jar包 -->
  390.         <dependency>
  391.             <groupId>org.hibernate</groupId>
  392.             <artifactId>hibernate-core</artifactId>
  393.             <version>${hibernate.core.version}</version>
  394.             <exclusions>
  395.                 <exclusion>
  396.                     <groupId>commons-logging</groupId>
  397.                     <artifactId>commons-logging</artifactId>
  398.                 </exclusion>
  399.                 <exclusion>
  400.                     <groupId>javassist</groupId>
  401.                     <artifactId>javassist</artifactId>
  402.                 </exclusion>
  403.             </exclusions>
  404.         </dependency>
  405.         <dependency>
  406.             <groupId>org.hibernate</groupId>
  407.             <artifactId>hibernate-entitymanager</artifactId>
  408.             <version>${hibernate.core.version}</version>
  409.         </dependency>
  410.         <dependency>
  411.             <groupId>org.javassist</groupId>
  412.             <artifactId>javassist</artifactId>
  413.             <version>${javassist.version}</version>
  414.             <exclusions>
  415.                 <exclusion>
  416.                     <groupId>commons-logging</groupId>
  417.                     <artifactId>commons-logging</artifactId>
  418.                 </exclusion>
  419.             </exclusions>
  420.         </dependency>
  421.         <dependency>
  422.             <groupId>org.hibernate</groupId>
  423.             <artifactId>hibernate-ehcache</artifactId>
  424.             <version>${hibernate.ehcache.version}</version>
  425.             <exclusions>
  426.                 <exclusion>
  427.                     <groupId>commons-logging</groupId>
  428.                     <artifactId>commons-logging</artifactId>
  429.                 </exclusion>
  430.                 <exclusion>
  431.                     <artifactId>ehcache-core</artifactId>
  432.                     <groupId>net.sf.ehcache</groupId>
  433.                 </exclusion>
  434.             </exclusions>
  435.         </dependency>
  436.         <dependency>
  437.             <groupId>org.hibernate.common</groupId>
  438.             <artifactId>hibernate-commons-annotations</artifactId>
  439.             <version>${hibernate.commons.annotaions.version}</version>
  440.             <exclusions>
  441.                 <exclusion>
  442.                     <groupId>commons-logging</groupId>
  443.                     <artifactId>commons-logging</artifactId>
  444.                 </exclusion>
  445.                 <exclusion>
  446.                     <groupId>org.hibernate</groupId>
  447.                     <artifactId>hibernate</artifactId>
  448.                 </exclusion>
  449.                 <exclusion>
  450.                     <groupId>commons-logging</groupId>
  451.                     <artifactId>commons-logging</artifactId>
  452.                 </exclusion>
  453.             </exclusions>
  454.         </dependency>
  455.         <!-- hibernate validator  相关jar包 -->
  456.         <dependency>
  457.             <groupId>org.hibernate</groupId>
  458.             <artifactId>hibernate-validator</artifactId>
  459.             <version>${hibernate.validator.version}</version>
  460.         </dependency>
  461.         <!-- apache shiro 相关jar包 -->
  462.         <dependency>
  463.             <groupId>org.apache.shiro</groupId>
  464.             <artifactId>shiro-core</artifactId>
  465.             <version>${shiro.version}</version>
  466.         </dependency>
  467.         <dependency>
  468.             <groupId>org.apache.shiro</groupId>
  469.             <artifactId>shiro-web</artifactId>
  470.             <version>${shiro.version}</version>
  471.         </dependency>
  472.         <dependency>
  473.             <groupId>org.apache.shiro</groupId>
  474.             <artifactId>shiro-aspectj</artifactId>
  475.             <version>${shiro.version}</version>
  476.         </dependency>
  477.         <dependency>
  478.             <groupId>org.apache.shiro</groupId>
  479.             <artifactId>shiro-ehcache</artifactId>
  480.             <version>${shiro.version}</version>
  481.         </dependency>
  482.         <dependency>
  483.             <groupId>org.apache.shiro</groupId>
  484.             <artifactId>shiro-spring</artifactId>
  485.             <version>${shiro.version}</version>
  486.         </dependency>
  487.         <!--<dependency>-->
  488.             <!--<groupId>org.apache.shiro</groupId>-->
  489.             <!--<artifactId>shiro-quartz</artifactId>-->
  490.             <!--<version>${shiro.version}</version>-->
  491.             <!--<exclusions>-->
  492.                 <!--<exclusion>-->
  493.                     <!--<artifactId>quartz</artifactId>-->
  494.                     <!--<groupId>org.opensymphony.quartz</groupId>-->
  495.                 <!--</exclusion>-->
  496.             <!--</exclusions>-->
  497.         <!--</dependency>-->
  498.         <!-- quartz -->
  499.         <!--<dependency>-->
  500.             <!--<groupId>org.quartz-scheduler</groupId>-->
  501.             <!--<artifactId>quartz</artifactId>-->
  502.             <!--<version>${quartz.version}</version>-->
  503.             <!--<exclusions>-->
  504.                 <!--<exclusion>-->
  505.                     <!--<artifactId>c3p0</artifactId>-->
  506.                     <!--<groupId>c3p0</groupId>-->
  507.                 <!--</exclusion>-->
  508.             <!--</exclusions>-->
  509.         <!--</dependency>-->
  510.         <!-- encache 相关jar包 -->
  511.         <dependency>
  512.             <groupId>net.sf.ehcache</groupId>
  513.             <artifactId>ehcache-core</artifactId>
  514.             <version>${ehcache.core.version}</version>
  515.             <scope>compile</scope>
  516.             <exclusions>
  517.                 <exclusion>
  518.                     <artifactId>slf4j-api</artifactId>
  519.                     <groupId>org.slf4j</groupId>
  520.                 </exclusion>
  521.             </exclusions>
  522.         </dependency>
  523.         <!-- json 相关jar包 -->
  524.         <dependency>
  525.             <groupId>com.alibaba</groupId>
  526.             <artifactId>fastjson</artifactId>
  527.             <version>${fastjson.version}</version>
  528.         </dependency>
  529.         <!-- 安全相关jar包 -->
  530.         <!-- httpclient相关jar包 -->
  531.         <dependency>
  532.             <groupId>org.apache.httpcomponents</groupId>
  533.             <artifactId>httpclient</artifactId>
  534.             <version>${httpclient.version}</version>
  535.             <exclusions>
  536.                 <exclusion>
  537.                     <groupId>commons-logging</groupId>
  538.                     <artifactId>commons-logging</artifactId>
  539.                 </exclusion>
  540.             </exclusions>
  541.         </dependency>
  542.         <!--dom4j-->
  543.         <dependency>
  544.             <groupId>dom4j</groupId>
  545.             <artifactId>dom4j</artifactId>
  546.             <version>${dom4j.version}</version>
  547.             <exclusions>
  548.                 <exclusion>
  549.                     <groupId>xml-apis</groupId>
  550.                     <artifactId>xml-apis</artifactId>
  551.                 </exclusion>
  552.             </exclusions>
  553.         </dependency>
  554.         <!-- 时间相关 -->
  555.         <!--日期美化-->
  556.         <dependency>
  557.             <groupId>org.ocpsoft.prettytime</groupId>
  558.             <artifactId>prettytime</artifactId>
  559.             <version>${prettytime.version}</version>
  560.         </dependency>
  561.         <!-- joda time 相关jar包 -->
  562.         <dependency>
  563.             <groupId>joda-time</groupId>
  564.             <artifactId>joda-time</artifactId>
  565.             <version>${joda-time.version}</version>
  566.         </dependency>
  567.         <!-- jcaptcha 验证码 -->
  568.         <dependency>
  569.             <groupId>com.octo.captcha</groupId>
  570.             <artifactId>jcaptcha</artifactId>
  571.             <version>${jcaptcha.version}</version>
  572.         </dependency>
  573.         <dependency>
  574.             <groupId>com.octo.captcha</groupId>
  575.             <artifactId>jcaptcha-integration-simple-servlet</artifactId>
  576.             <version>${jcaptcha.version}</version>
  577.             <exclusions>
  578.                 <exclusion>
  579.                     <artifactId>servlet-api</artifactId>
  580.                     <groupId>javax.servlet</groupId>
  581.                 </exclusion>
  582.             </exclusions>
  583.         </dependency>
  584.         <!-- html处理jar包 -->
  585.         <dependency>
  586.             <groupId>org.jsoup</groupId>
  587.             <artifactId>jsoup</artifactId>
  588.             <version>${jsoup.version}</version>
  589.         </dependency>
  590.     </dependencies>
  591.     
  592.           <build>
  593.                 <outputDirectory>${project.basedir}/src/main/webapp/WEB-INF/classes/</outputDirectory>
  594.                 <plugins>
  595.                         <!-- Compiler 插件, 设定JDK版本 -->
  596.                         <plugin>
  597.                                 <groupId>org.apache.maven.plugins</groupId>
  598.                                 <artifactId>maven-compiler-plugin</artifactId>
  599.                                 <version>2.5.1</version>
  600.                                 <configuration>
  601.                                         <source>${jdk.version}</source>
  602.                                         <target>${jdk.version}</target>
  603.                                         <showWarnings>true</showWarnings>
  604.                                 </configuration>
  605.                         </plugin>
  606.                         <!-- war 打包插件, 设定war包名称不带版本号 -->
  607.                         <plugin>
  608.                                 <groupId>org.apache.maven.plugins</groupId>
  609.                                 <artifactId>maven-war-plugin</artifactId>
  610.                                 <version>2.3</version>
  611.                                 <configuration>
  612.                                         <warName>${project.artifactId}</warName>
  613.                                 </configuration>
  614.                         </plugin>
  615.                         
  616.                         <!-- Eclipse 插件 -->
  617.                         <plugin>
  618.                                 <groupId>org.apache.maven.plugins</groupId>
  619.                                 <artifactId>maven-eclipse-plugin</artifactId>
  620.                                 <version>2.9</version>
  621.                                 <configuration>
  622.                                         <downloadSources>false</downloadSources>
  623.                                         <downloadJavadocs>false</downloadJavadocs>
  624.                                         <wtpversion>2.0</wtpversion>
  625.                                         <!-- 增加设置项目encoding的文件 -->
  626.                                         <additionalConfig>
  627.                                                 <file>
  628.                                                         <name>.settings/org.eclipse.core.resources.prefs</name>
  629.                                                         <content>
  630.                                                         <![CDATA[eclipse.preferences.version=1${line.separator}encoding/<project>=${project.build.sourceEncoding}${line.separator}]]>
  631.                                                         </content>
  632.                                                 </file>
  633.                                         </additionalConfig>
  634.                                         <additionalProjectnatures>
  635.                                                 <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
  636.                                         </additionalProjectnatures>
  637.                                 </configuration>
  638.                         </plugin>
  639.                         
  640.                         <!-- tomcat6插件 -->
  641.                         <plugin>
  642.                                 <groupId>org.apache.tomcat.maven</groupId>
  643.                                 <artifactId>tomcat6-maven-plugin</artifactId>
  644.                                 <version>${tomcat.version}</version> 
  645.                                 <configuration>
  646.                                         <path>/${project.artifactId}</path>
  647.                                 </configuration>
  648.                         </plugin>
  649.                         
  650.                         <!-- tomcat7插件 -->
  651.                         <plugin>
  652.                                 <groupId>org.apache.tomcat.maven</groupId>
  653.                                 <artifactId>tomcat7-maven-plugin</artifactId>
  654.                                 <version>${tomcat.version}</version> 
  655.                                 <configuration>
  656.                                         <path>/${project.artifactId}</path>
  657.                                 </configuration>
  658.                         </plugin>
  659.                         <!-- jetty插件 -->
  660.                         <plugin>
  661.                                 <groupId>org.mortbay.jetty</groupId>
  662.                                 <artifactId>jetty-maven-plugin</artifactId>
  663.                                 <version>${jetty.version}</version> 
  664.                                 <configuration>
  665.                                         <webAppConfig>
  666.                                                 <contextPath>/${project.artifactId}</contextPath>
  667.                                         </webAppConfig>
  668.                                 </configuration>
  669.                         </plugin>
  670.                         
  671.                         <!-- resource插件 -->
  672.                         <plugin>
  673.                                 <groupId>org.apache.maven.plugins</groupId>
  674.                                 <artifactId>maven-resources-plugin</artifactId>
  675.                                 <version>2.6</version>
  676.                         </plugin>
  677.                         
  678.                         <!-- install插件 -->
  679.                         <plugin>
  680.                                 <groupId>org.apache.maven.plugins</groupId>
  681.                                 <artifactId>maven-install-plugin</artifactId>
  682.                                 <version>2.4</version>
  683.                         </plugin>
  684.                         <!-- clean插件 -->
  685.                         <plugin>
  686.                                 <groupId>org.apache.maven.plugins</groupId>
  687.                                 <artifactId>maven-clean-plugin</artifactId>
  688.                                 <version>2.5</version>
  689.                         </plugin>
  690.                         
  691.                         <!-- ant插件 -->
  692.                         <plugin>
  693.                                 <groupId>org.apache.maven.plugins</groupId>
  694.                                 <artifactId>maven-antrun-plugin</artifactId>
  695.                                 <version>1.7</version>
  696.                         </plugin>
  697.                         
  698.                         <!-- dependency插件 -->
  699.                         <plugin>
  700.                                 <groupId>org.apache.maven.plugins</groupId>
  701.                                 <artifactId>maven-dependency-plugin</artifactId>
  702.                                 <version>2.5.1</version>
  703.                         </plugin>
  704.                 </plugins>
  705.         </build>
  706. </project>

转自: http://bbs.html580.com/forum.php?mod=viewthread&tid=178107&extra=page%3D1

猜你喜欢

转载自zyg345646335.iteye.com/blog/2100061