From 19d7cedcf2e2a4c6ab837fe59d929a0a26c83f4c Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 4 Dec 2012 19:52:37 +0100 Subject: [PATCH] Fix classpaths regarding slf4j versions - Defined global slf4jVersion as '1.6.1' in the Gradle build. - Replaced dependencies on slf4j-log4j12 with slf4j-jcl where possible; however, spring-test-mvc still depends on jcl-over-slf4j and slf4j-log4j12 (see SPR-10070). - Reenabled HibernateSessionFlushingTests. - Verified that the following tests pass in the Gradle build and within Eclipse: - HibernateSessionFlushingTests - HibernateTransactionManagerTests (Hibernate 3) - HibernateTransactionManagerTests (Hibernate 4) - RequestResponseBodyMethodProcessorTests Issue: SPR-9421, SPR-10066 --- build.gradle | 25 +++++++++---------- .../orm/HibernateSessionFlushingTests.java | 3 ++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 949660fcde..27a5521207 100644 --- a/build.gradle +++ b/build.gradle @@ -10,11 +10,12 @@ buildscript { } configure(allprojects) { - ext.aspectjVersion = '1.6.12' - ext.easymockVersion='2.5.2' - ext.hsqldbVersion='1.8.0.10' - ext.junitVersion = '4.11.20120805.1225' // temporary use of snapshot; spring-test - // still builds against 4.10 + ext.aspectjVersion = '1.6.12' + ext.easymockVersion = '2.5.2' + ext.hsqldbVersion = '1.8.0.10' + ext.junitVersion = '4.11.20120805.1225' // temporary use of snapshot; + // spring-test still builds against 4.10 + ext.slf4jVersion = '1.6.1' ext.gradleScriptDir = "${rootProject.projectDir}/gradle" apply plugin: 'java' @@ -256,7 +257,7 @@ project('spring-context') { compile("org.codehaus.groovy:groovy-all:1.8.8", optional) compile("org.jruby:jruby:1.6.5.1", optional) compile("joda-time:joda-time:2.1", optional) - compile("org.slf4j:slf4j-api:1.6.1", optional) + compile("org.slf4j:slf4j-api:${slf4jVersion}", optional) compile("org.hibernate:hibernate-validator:4.3.0.Final") { dep -> optional dep exclude group: 'org.slf4j', module: 'slf4j-api' @@ -425,7 +426,7 @@ project('spring-orm') { compile("javax.jdo:jdo-api:3.0", optional) compile("org.apache.ibatis:ibatis-sqlmap:2.3.4.726", optional) testCompile "javax.servlet:servlet-api:2.5" - testCompile "org.slf4j:slf4j-jcl:1.6.1" + testCompile "org.slf4j:slf4j-jcl:${slf4jVersion}" testCompile "commons-dbcp:commons-dbcp:1.2.2" testCompile "org.eclipse.persistence:org.eclipse.persistence.asm:1.0.1" testCompile "org.eclipse.persistence:org.eclipse.persistence.antlr:1.0.1" @@ -487,9 +488,7 @@ project('spring-webmvc') { compile("javax.servlet:jstl:1.1.2", provided) compile("org.apache.tomcat:tomcat-servlet-api:7.0.32", provided) // servlet-api 3.0 testCompile project(":spring-aop") - testCompile("org.slf4j:slf4j-log4j12:1.6.1") { - exclude group: 'log4j', module: 'log4j' - } + testCompile "org.slf4j:slf4j-jcl:${slf4jVersion}" testCompile "rhino:js:1.7R1" testCompile "xmlunit:xmlunit:1.2" testCompile("dom4j:dom4j:1.6.1") { @@ -570,7 +569,7 @@ project('spring-test') { compile("javax.servlet.jsp:jsp-api:2.1", optional) compile("javax.portlet:portlet-api:2.0", optional) compile("javax.activation:activation:1.0", provided) - testCompile "org.slf4j:slf4j-jcl:1.5.3" + testCompile "org.slf4j:slf4j-jcl:${slf4jVersion}" } } @@ -587,8 +586,8 @@ project('spring-test-mvc') { compile("org.hamcrest:hamcrest-core:1.3", optional) compile("com.jayway.jsonpath:json-path:0.8.1", optional) compile("xmlunit:xmlunit:1.2", optional) - testCompile("org.slf4j:jcl-over-slf4j:1.6.1") - testCompile("org.slf4j:slf4j-log4j12:1.6.1") { + testCompile("org.slf4j:jcl-over-slf4j:${slf4jVersion}") + testCompile("org.slf4j:slf4j-log4j12:${slf4jVersion}") { exclude group: 'log4j', module: 'log4j' } testCompile("log4j:log4j:1.2.15") { diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/HibernateSessionFlushingTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/HibernateSessionFlushingTests.java index 1389ee8aec..3c32c47b82 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/orm/HibernateSessionFlushingTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/orm/HibernateSessionFlushingTests.java @@ -23,8 +23,10 @@ import static org.springframework.test.transaction.TransactionTestUtils.assertIn import org.hibernate.SessionFactory; import org.hibernate.exception.ConstraintViolationException; import org.hibernate.exception.GenericJDBCException; + import org.junit.Before; import org.junit.Test; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; @@ -39,7 +41,6 @@ import org.springframework.test.context.junit4.orm.service.PersonService; * @author Sam Brannen * @since 3.0 */ -@org.junit.Ignore // TODO SPR-8116 (Hibernate classpath-related) @ContextConfiguration public class HibernateSessionFlushingTests extends AbstractTransactionalJUnit4SpringContextTests {