我试图使用spring-test-mvc来测试我的小应用程序中的控制器。由于我使用gradle这个作为构建工具我说这样依赖于它:Gradle不包括传递依赖项
testCompile 'org.springframework:spring-test-mvc:1.0.0.M1'
它成功检索弹簧试验-MVC,并编译测试。但是执行测试失败,因为它似乎不包括像mvc测试那样的瞬态依赖。
除其他它抱怨没有找到
org.springframework.mock.web.MockHttpServletRequest
哪个是弹簧Test.jar的,其包括在如弹簧测试-MVC小号的pom.xml的相关性的一部分https://github.com/SpringSource/spring-test-mvc/blob/master/pom.xml
我可以通过包括依赖明确地构建文件中解决这个问题:
testCompile 'org.springframework:spring-test:3.1.1.RELEASE'
,但它只是被下一个问题所取代。我试图明确要求瞬态依赖关系:
testCompile ('org.springframework:spring-test-mvc:1.0.0.M1') {
transitive = true
}
但是,这不会改变任何东西。
所以问题是:我如何得到gradle以在类路径中包含传递依赖关系。
注意:传递依赖似乎在测试之外很好地工作。
嗯,这将解释它。让我们看看这个项目的开发者说什么:https://github.com/SpringSource/spring-test-mvc/issues/41 – 2012-07-15 16:10:59