【问题标题】:Gradle doesn't include transitive dependenciesGradle 不包含传递依赖
【发布时间】:2012-07-15 15:13:45
【问题描述】:

我正在尝试使用spring-test-mvc 在我的小应用程序中测试控制器。因为我使用 gradle 作为构建工具,所以我像这样添加了依赖项:

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

成功获取spring-test-mvc,并编译测试。但是执行测试失败了,因为它似乎不包括像 mvc test 这样的瞬态依赖。

其中包括抱怨找不到

org.springframework.mock.web.MockHttpServletRequest

这是spring-test.jar的一部分,作为依赖包含在spring-test-mvc s 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 在类路径中包含传递依赖项。

注意:传递依赖似乎在测试之外也能正常工作。

【问题讨论】:

    标签: gradle transitive-dependency spring-test-mvc


    【解决方案1】:

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-11
    • 1970-01-01
    • 2020-02-12
    • 1970-01-01
    • 1970-01-01
    • 2014-11-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多