Pregunta

I'm trying to use spring-test-mvc for testing a controller in my little application. Since I use gradle as build tool I added the dependency to it like this:

testCompile 'org.springframework:spring-test-mvc:1.0.0.M1'

It succeeds to retrieve spring-test-mvc, and compile the tests. But executing the tests fails, because it doesn't seem to include transient dependencies like mvc test.

Among others it complains about not finding

org.springframework.mock.web.MockHttpServletRequest

Which is part of the spring-test.jar, which is included as a dependency in spring-test-mvc s pom.xml https://github.com/SpringSource/spring-test-mvc/blob/master/pom.xml

I can fix that problem by including the dependency explicitely in the build file:

testCompile 'org.springframework:spring-test:3.1.1.RELEASE'

But it just gets replaced by the next problem. I tried to explicitly ask for transient dependencies:

testCompile ('org.springframework:spring-test-mvc:1.0.0.M1') {
        transitive = true
    }

But that doesn't seedm to change anything.

So the question is: How do I get gradle to include transitive dependencies in the classpath.

Note: Transitive dependencies seem to work fine outside of tests.

¿Fue útil?
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top