什么是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>

View Code

基本的设置:

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

View Code

转载于:https://www.cnblogs.com/linbo3168/p/6558601.html

maven Web项目中POM的配置信息相关推荐

  1. maven mybatis mysql_Java Web学习系列——Maven Web项目中集成使用Spring、MyBatis实现对MySQL的数据访问...

    标签: 本篇内容还是建立在上一篇Java Web学习系列--Maven Web项目中集成使用Spring基础之上,对之前的Maven Web项目进行升级改造,实现对MySQL的数据访问. 添加依赖Ja ...

  2. maven web项目中的web.xml的版本如何更改

    maven web项目中的web.xml的版本如何更改 问题 因web.xml的版本太低不支持el表达式的问题(maven3.6版本通过底层的maven web插件生成的最终的web.xml文件版本只 ...

  3. 在maven web项目中配置log4j打印日志及Mybatis sql语句

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/wei542657623/article/details/51591736 1 添加依赖 在pom.x ...

  4. idea创建maven web项目,pom.xml文件一直显示红色

    想在idea里面用maven创建一个web项目 要配置maven, 刚开始使用的是maven的3.8.5的版本 (首先你的maven要先配置好,可以在终端输入mvn -v查看maven安装情况, 然后 ...

  5. maven web项目显示红叉叉

    1.)新建 maven web 项目中(代码没问题,但Java resources总会显示红色的叉叉);pom.xml第一行也显示红色的叉 解决方法: Description Resource  Pa ...

  6. IDEA中创建Maven Web项目(两种方式)

    IDEA中创建Maven Web项目 一.使用骨架(项目模板)创建Maven Web项目 二.不使用骨架直接创建 一.使用骨架(项目模板)创建Maven Web项目 选择Web项目骨架,创建项目 删除 ...

  7. 详解log4j2(下) - Log4j2在WEB项目中配置

    官方介绍和学习文档网址为http://logging.apache.org/log4j/2.x/ 首先在WEB项目中引入以下几个jar包: ① log4j-api-2.4.1.jar ② log4j- ...

  8. 解决eclipse中tomcat无法识别maven web项目问题

    eclipse工具中导入了maven web项目, 但是tomcat死活都识别不了, maven项目进行了clean install等操作, 但是仍无效, 后在网上搜索到以下答案, 解决问题 1. 右 ...

  9. java web access_Java Web项目中连接Access数据库的配置方法

    本文是对前几天的"JDBC连接Access数据库的几种方式"这篇的升级.因为在做一些小项目的时候遇到的问题,因此才决定写这篇博客的.昨天已经将博客公布了.可是后来经过一些验证有点问 ...

最新文章

  1. 快速搭建samba服务
  2. Unity3D 简单的倒计时
  3. go标准库的学习-fmt
  4. 关于Asp.net页面的刷新
  5. AAAI 2022 | 北大 阿里达摩院:基于对比学习的预训练语言模型剪枝压缩
  6. 漫谈数据仓库之维度建模
  7. 计算机专业论文范文精选,计算机毕业论文提纲范文精选
  8. html里获取数组里的值,如何从HTML数组获取textarea的值
  9. ubuntu 14.04 挂载window共享目录
  10. ASCII, GB2312, GBK, Unicode, UTF8之间的区别和联系
  11. 计算机主机要系统,计算机系统(主机).ppt
  12. Atitit uke plnsy安全隐私保护法案 目录 第一章 一般规定 2 第1节 主题与目标 2 第二章 常见安全原则 3 第1节 隔离 保密 shell 3 第2节 隐藏 保密 不出头 3
  13. block才会执行 mono_Monogb基本概念及基本操作
  14. 科技爱好者周刊(第 179 期):AR 技术的打开方式
  15. ubuntu下载chrome等软件
  16. SSM框架Web程序的流程(Spring SpringMVC Mybatis)
  17. npcap关闭_Npcap.资料
  18. 杭州优科豪马轮胎有限公司北京经销商
  19. 记一次阿里电话面试(java技术岗)
  20. django之admin调整页面展示

热门文章

  1. PDF文件去除页边距空白
  2. 古墓丽影10linux,《古墓丽影:崛起》Linux 版上架 Steam
  3. python爬网站图片教程_Python超简单的爬取网站中图片
  4. 【Android实战】----基于Retrofit实现多图片/文件、图文上传
  5. 编译flink1.9.0 报flink-fs-hadoop-shaded找不到
  6. 低延时直播系统开发技术方案
  7. C#中的ASCII转换
  8. html网页随机一言,PHP简单实现一言 / 随机语录功能
  9. 蜡笔同步 java_蜡笔同步常见问题解析
  10. 微信公众平台开发解惑