-
Notifications
You must be signed in to change notification settings - Fork 123
/
pom.xml
555 lines (467 loc) · 22 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.youmeek</groupId>
<artifactId>ssjpa</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>ssjpa</name>
<description>
为了方便以后的一些问题的讲解特地准备一个最精简的 SpringMVC+Spring+Spring Data JPA 框架整合,方便以后的一些问题的演示
</description>
<url>http://code.YouMeek.com</url>
<!--
Spring Data JPA 资料:
官网:http://projects.spring.io/spring-data-jpa
官网文档:http://docs.spring.io/spring-data/jpa/docs/1.10.1.RELEASE/reference/html/
http://blog.csdn.net/csujiangyu/article/details/48804731
http://blog.csdn.net/luzhenyu111/article/details/43917947,很好
http://blog.csdn.net/luckyzhoustar/article/details/49362951
======================================================
hibernate 官网:http://hibernate.org/orm/downloads/
-->
<!-- 集中定义公用的依赖版本号 -->
<!--版本变量设置 start-->
<properties>
<!--架包版本变量 start-->
<!--框架整体结构-->
<spring.version>4.2.5.RELEASE</spring.version>
<spring-data-jpa.version>1.10.1.RELEASE</spring-data-jpa.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<!--下面这两个是springAOP需要用到-->
<!--spring-aspects依赖这个,所以这个也可以注释掉,除非有特定jar需要更高或是更低版本的时候我们再来指定-->
<!--<aspectjweaver.version>1.8.7</aspectjweaver.version>-->
<!--Spring Data JPA 依赖这个,它会自己去找-->
<!--<aspectjrt.version>1.8.9</aspectjrt.version>-->
<junit.version>4.11</junit.version>
<mysql-connector.version>5.1.21</mysql-connector.version>
<druid.version>1.0.4</druid.version>
<!--<slf4j.version>1.7.7</slf4j.version>-->
<log4j.version>1.2.17</log4j.version>
<javaee-api.version>7.0</javaee-api.version>
<jstl.version>1.2</jstl.version>
<jsp-api.version>2.0</jsp-api.version>
<servlet-api.version>2.5</servlet-api.version>
<!--工具类依赖 start-->
<commons-fileupload.version>1.3.1</commons-fileupload.version>
<commons-io.version>2.4</commons-io.version>
<commons-lang3.version>3.3.2</commons-lang3.version>
<commons-collections.version>3.2.1</commons-collections.version>
<httpclient.version>4.3.5</httpclient.version>
<jackson-databind.version>2.4.2</jackson-databind.version>
<fastjson.version>1.1.43</fastjson.version>
<guava.version>17.0</guava.version>
<!--工具类依赖 end-->
<!--架包版本变量 end-->
<!--插件版本变量 start-->
<tomcat6-maven-plugin.version>2.1</tomcat6-maven-plugin.version>
<tomcat7-maven-plugin.version>2.2</tomcat7-maven-plugin.version>
<jetty-plugin.version>8.1.16.v20140903</jetty-plugin.version>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
<maven-war-plugin.version>2.3</maven-war-plugin.version>
<maven-resources-plugin.version>2.6</maven-resources-plugin.version>
<maven-install-plugin.version>2.4</maven-install-plugin.version>
<maven-clean-plugin.version>2.5</maven-clean-plugin.version>
<maven-antrun-plugin.version>1.7</maven-antrun-plugin.version>
<maven-dependency-plugin.version>2.5.1</maven-dependency-plugin.version>
<maven-source-plugin.version>2.2.1</maven-source-plugin.version>
<!--插件版本变量 end-->
<!--其他变量 start-->
<war-name.version>ssjpa</war-name.version>
<jdk.version>1.7</jdk.version>
<tomcat-port.version>8080</tomcat-port.version>
<tomcat-uri-encoding.version>UTF-8</tomcat-uri-encoding.version>
<tomcat-path.version>/</tomcat-path.version>
<jetty-port.version>8080</jetty-port.version>
<jetty-path.version>/</jetty-path.version>
<!--其他变量 end-->
<!--这个配置是为了解决下面两个警告-->
<!--Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!-->
<!--File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!-->
<!--指定Maven用什么编码来读取源码及文档-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--指定Maven用什么编码来呈现站点的HTML文件-->
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<!--版本变量设置 end-->
<!--架包依赖 start-->
<dependencies>
<!-- ############################################################### Spring 相关包 start ############################################################### -->
<!--spring 源码包下载地址:https://github.com/spring-projects/spring-framework/releases-->
<!--http://takeme.iteye.com/blog/1977585-->
<!--http://blog.csdn.net/bluishglc/article/details/6585221-->
<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-web</artifactId>
<version>${spring.version}</version>
</dependency>
<!--这个jar 文件包含Spring MVC 框架相关的所有类。包括框架的Servlets,Web MVC框架,控制器和视图支持。当然,如果你的应用使用了独立的MVC 框架,则无需这个JAR 文件里的任何类。 外部依赖spring-web-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!--这个jar 文件包含支持UI模版(Velocity,FreeMarker,JasperReports),邮件服务,脚本服务(JRuby),缓存Cache(EHCache),任务计划Scheduling(uartz)方面的类。 外部依赖spring-context-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<!--下面两个提供对 AspectJ 的支持,是 spring-aspects 所需要依赖的-->
<!--<dependency>-->
<!--<groupId>org.aspectj</groupId>-->
<!--<artifactId>aspectjweaver</artifactId>-->
<!--<version>${aspectjweaver.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.aspectj</groupId>-->
<!--<artifactId>aspectjrt</artifactId>-->
<!--<version>${aspectjrt.version}</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring-data-jpa.version}</version>
</dependency>
<!--hibernate 官网:http://hibernate.org/orm/downloads/-->
<!--因为这里要使用的 hibernate 主要是配合 Spring Data jpa 使用,所以版本的要求最好看 Spring Data JPA 官网:http://projects.spring.io/spring-data-jpa/-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!--ehcache 缓存 start-->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.10.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!--ehcache 缓存 end-->
<!-- ############################################################### Spring 相关包 end ############################################################### -->
<!-- 导入Mysql数据库链接jar包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<!--这个组件具体可以看这里介绍:http://www.oschina.net/p/druid-->
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- JSTL标签类 -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>${jsp-api.version}</version>
<scope>provided</scope>
</dependency>
<!-- java ee jar 包 -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${javaee-api.version}</version>
<scope>provided</scope>
</dependency>
<!--单元测试-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- 日志文件管理包 start -->
<!--下面这三个是配套使用:http://blog.csdn.net/woshiwxw765/article/details/7624556-->
<!--使用log4j start-->
<!--<dependency>-->
<!--<groupId>log4j</groupId>-->
<!--<artifactId>log4j</artifactId>-->
<!--<version>${log4j.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.slf4j</groupId>-->
<!--<artifactId>slf4j-api</artifactId>-->
<!--<version>${slf4j.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.slf4j</groupId>-->
<!--<artifactId>slf4j-log4j12</artifactId>-->
<!--<version>${slf4j.version}</version>-->
<!--</dependency>-->
<!--使用log4j end-->
<!--使用logback start-->
<!--导入这个的时候会自动导入:slf4j-api、logback-core,所以我们还需要导入:log4j和logback-ext-spring-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.logback-extensions</groupId>
<artifactId>logback-ext-spring</artifactId>
<version>0.1.4</version>
</dependency>
<!--使用logback end-->
<!-- 日志文件管理包 end -->
<!--JSON处理-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>
<!--常用工具类-整理-start-->
<!-- 上传组件包 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons-fileupload.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<!--apache工具包 集合工具类-->
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${commons-collections.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<!-- httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<!--常用工具类-整理-end-->
</dependencies>
<!--架包依赖 end-->
<!--设置项目编译级别等设置 start-->
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<!--表示把java目录下的有关xml文件,properties文件编译/打包的时候放在resource目录下-->
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<!-- Compiler 插件, 设定JDK版本 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<!-- war 打包插件, 设定war包名称不带版本号 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<warName>${war-name.version}</warName>
</configuration>
</plugin>
<!-- tomcat6插件 -->
<!--https://tomcat.apache.org/maven-plugin-2.0/tomcat6-maven-plugin/run-mojo.html-->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>${tomcat6-maven-plugin.version}</version>
<configuration>
<!--项目访问路径 这里直接使用根目录就可以了,访问地址http://localhost:8080/ -->
<!-- 如果这里配置了,比如test,那访问地址就需要变成:http://localhost:8080/test-->
<path>${tomcat-path.version}</path>
<port>${tomcat-port.version}</port>
<!--tomcat的url编码 达到和修改server.xml文件一样的功能-->
<uriEncoding>${tomcat-uri-encoding.version}</uriEncoding>
<!--配置远程tomcat管理的连接路径地址(固定的一个链接)-->
<url>http://localhost:8080/manager/html</url>
<server>tomcat6</server>
</configuration>
</plugin>
<!--tomcat7插件-->
<!--https://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/run-mojo.html-->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat7-maven-plugin.version}</version>
<configuration>
<path>${tomcat-path.version}</path>
<port>${tomcat-port.version}</port>
<uriEncoding>${tomcat-uri-encoding.version}</uriEncoding>
<url>http://localhost:8080/manager/text</url>
<server>tomcat7</server>
<username>admin</username>
<password>admin</password>
</configuration>
</plugin>
<!--jetty插件-->
<!--http://www.eclipse.org/jetty/documentation/9.0.0.M3/jetty-maven-plugin.html-->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-plugin.version}</version>
<configuration>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>${jetty-port.version}</port>
</connector>
</connectors>
<webApp>
<!--访问地址:http://localhost:8080/index.jsp-->
<!--如果不带index.jsp会直接报404,这个一直没找到原因-->
<contextPath>${jetty-path.version}</contextPath>
</webApp>
<!--scanIntervalSeconds 可选[秒]。在很短的时间间隔内在扫描web应用检查是否有改变,如果发觉有任何改变则自动热部署。默认为0,表示禁用热部署检查。任何一个大于0的数字都将表示启用。-->
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
<!-- resource插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
</plugin>
<!-- source插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
</plugin>
<!-- install插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${maven-install-plugin.version}</version>
</plugin>
<!-- clean插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
</plugin>
<!-- ant插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
</plugin>
<!-- dependency插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
</plugin>
</plugins>
</build>
<!--设置项目编译级别等设置 end-->
</project>