先说下我们的开发环境,用的Eclipse版本为最新下载的Eclipse for JavaEE, Mars.2 Release (4.5.2),已经内置了maven,因为外面maven越来越流行,而且管理库依赖非常方便,所以也顺便用学习学习,但这几天的使用感觉,eclipse下的maven有点傻,而且会无缘无故让项目的配置参数丢失,最后不知道动了什么修改的xml文件、java文件不会自动编译了亦不会同步到tomcat的调试目录,为此不得不重新恢复之前的备份。
用的框架版本:spring 4.2.0.RELEASE, hibernate-core/hibernate-entitymanager版本4.3.5.Final,postgresql jdbc版本9.4.1208
下面给出完整的pom.xml, pom配置对spring来说至关重要,因为一不小心配置里面有不同版本的依赖同时存在,就很可以让整个spring加载不起来!
(16/Jun/2016重新修改)
4.0.0
com.freestyle.gpchat
gpchat
war
0.0.1-SNAPSHOT
gpchat Maven Webapp
http://maven.apache.org
4.2.0.RELEASE
2.3.28.1
1.8.7
4.3.5.Final
3.2.7.ga
javax.servlet
jstl
1.2
junit
junit
3.8.1
test
org.springframework
spring-core
${spring.version}
org.springframework
spring-web
${spring.version}
org.springframework
spring-webmvc
${spring.version}
org.springframework
spring-jdbc
${spring.version}
org.springframework
spring-orm
${spring.version}
org.aspectj
aspectjrt
${aspectj.version}
org.aspectj
aspectjweaver
1.8.9
org.apache.struts
struts2-core
${struts.version}
javassist
javassist
asm
asm
asm
asm-commons
org.ow2.asm
asm
org.ow2.asm
asm-commons
org.apache.struts
struts2-spring-plugin
${struts.version}
org.apache.struts
struts2-convention-plugin
${struts.version}
org.hibernate
hibernate-core
${spring-hibernate.version}
org.javassist
javassist
org.hibernate
hibernate-entitymanager
4.3.11.Final
org.postgresql
postgresql
9.4.1208
commons-fileupload
commons-fileupload
1.3.1
com.cloudhopper.proxool
proxool
0.9.1
org.apache.httpcomponents
httpcore
4.3.2
org.apache.httpcomponents
httpmime
4.3.2
com.fasterxml.jackson.core
jackson-databind
2.6.3
com.fasterxml.jackson.core
jackson-core
2.6.3
com.fasterxml.jackson.core
jackson-annotations
2.6.3
log4j
log4j
1.2.17
javax.mail
mail
1.4.7
commons-logging
commons-logging
1.1.1
com.belerweb
pinyin4j
2.5.0
com.google.zxing
core
3.2.0
org.apache.commons
commons-lang3
3.0
commons-beanutils
commons-beanutils
1.9.2
cglib
cglib
3.1
gpchat
src/main/java
src/test/java
src/main/resources
src/test/resources
src/main/webapp/WEB-INF/classes
src/main/webapp/WEB-INF/classes
org.apache.maven.plugins
maven-compiler-plugin
3.2
1.6
maven-resources-plugin
2.5
compile
maven-clean-plugin
2.4.1
src/main/webapp/WEB-INF/lib
false
maven install后,请打开target\xxx\WEB-INF\lib,仔细检查是否有同一个jar是否有不同版本存在,如果有,则说明pom里面有重复配置,需要删除,按照上面的pom.xml运行,我的jar file list 如下:
2016/06/01 09:21 62,983 activation-1.1.jar
2015/09/11 10:56 445,288 antlr-2.7.7.jar
2015/09/11 10:56 4,467 aopalliance-1.0.jar
2016/06/16 11:59 47,895 asm-4.2.jar
2015/12/25 16:37 116,927 aspectjrt-1.8.7.jar
2016/06/14 11:53 1,864,922 aspectjweaver-1.8.9.jar
2016/01/18 17:35 32,112 avalon-framework-api-4.3.jar
2016/01/18 17:35 83,582 avalon-logkit-2.1.jar
2016/06/16 11:59 283,080 cglib-3.1.jar
2016/06/15 12:17 233,859 commons-beanutils-1.9.2.jar
2016/05/31 17:51 232,771 commons-codec-1.6.jar
2015/09/11 10:56 575,389 commons-collections-3.2.1.jar
2016/01/19 09:17 69,002 commons-fileupload-1.3.1.jar
2016/01/19 09:17 173,587 commons-io-2.2.jar
2016/06/15 12:14 306,008 commons-lang3-3.0.jar
2015/09/12 10:49 60,686 commons-logging-1.1.1.jar
2016/06/01 09:21 544,173 core-3.2.0.jar
2016/05/31 17:14 313,898 dom4j-1.6.1.jar
2016/05/31 17:42 1,300,487 freemarker-2.3.22.jar
2016/01/18 17:35 96,369 geronimo-spec-javamail-1.3.1-rc3.jar
2016/01/18 17:35 30,838 geronimo-spec-jms-1.1-rc4.jar
2016/06/14 10:46 75,311 hibernate-commons-annotations-4.0.4.Final.jar
2016/06/14 10:46 5,230,007 hibernate-core-4.3.5.Final.jar
2016/06/14 10:22 648,087 hibernate-entitymanager-4.3.11.Final.jar
2016/06/13 17:01 113,371 hibernate-jpa-2.1-api-1.0.0.Final.jar
2016/05/31 17:50 587,762 httpclient-4.3.2.jar
2016/05/31 17:49 282,269 httpcore-4.3.2.jar
2016/05/31 17:49 37,148 httpmime-4.3.2.jar
2016/05/31 17:53 46,989 jackson-annotations-2.6.3.jar
2016/05/31 17:53 258,875 jackson-core-2.6.3.jar
2016/05/31 17:52 1,170,801 jackson-databind-2.6.3.jar
2016/06/14 10:47 76,551 jandex-1.1.0.Final.jar
2016/06/14 10:47 714,194 javassist-3.18.1-GA.jar
2016/06/14 10:46 57,183 jboss-logging-3.1.3.GA.jar
2016/06/14 10:22 11,558 jboss-logging-annotations-1.2.0.Beta1.jar
2016/06/14 10:22 27,717 jboss-transaction-api_1.2_spec-1.0.0.Final.jar
2015/12/22 12:09 414,240 jstl-1.2.jar
2016/06/01 09:20 489,884 log4j-1.2.17.jar
2016/06/01 09:21 521,157 mail-1.4.7.jar
2016/05/31 17:33 230,352 ognl-3.0.14.jar
2016/06/01 09:21 209,862 pinyin4j-2.5.0.jar
2016/05/31 17:43 648,601 postgresql-9.4.1208.jar
2016/01/18 17:35 200,759 proxool-0.9.1.jar
2016/01/18 15:35 334,469 proxool-cglib-0.9.1.jar
2016/01/18 17:35 77,977 servlet-api-2.3.jar
2016/06/14 10:20 363,974 spring-aop-4.2.0.RELEASE.jar
2016/06/14 10:20 729,550 spring-beans-4.2.0.RELEASE.jar
2016/06/14 10:21 1,084,471 spring-context-4.2.0.RELEASE.jar
2016/06/14 10:19 1,052,383 spring-core-4.2.0.RELEASE.jar
2016/06/14 10:21 262,391 spring-expression-4.2.0.RELEASE.jar
2016/06/14 10:22 421,645 spring-jdbc-4.2.0.RELEASE.jar
2016/06/14 10:52 465,589 spring-orm-4.2.0.RELEASE.jar
2016/06/14 10:22 262,961 spring-tx-4.2.0.RELEASE.jar
2016/06/14 10:19 765,877 spring-web-4.2.0.RELEASE.jar
2016/06/14 10:21 865,404 spring-webmvc-4.2.0.RELEASE.jar
2016/05/31 17:33 67,524 struts2-convention-plugin-2.3.28.1.jar
2016/05/31 17:31 874,267 struts2-core-2.3.28.1.jar
2016/05/31 17:33 21,696 struts2-spring-plugin-2.3.28.1.jar
2016/05/31 17:15 109,318 xml-apis-1.0.b2.jar
2016/05/31 17:33 677,347 xwork-core-2.3.28.1.jar