【问题标题】:Testing with Gradle使用 Gradle 进行测试
【发布时间】:2016-05-04 22:07:21
【问题描述】:

测试失败。
如何修复异常? 这是堆栈跟踪和代码:

Could not determine the dependencies of task ':test'.
Configuration with name 'default' not found.

我的父母 settings.gradle

rootProject.name = 'opti'
include 'web'

build.gradle

allprojects {
    repositories {
        mavenCentral()
    }

    group 'com.opti'
    version '1.0'

    apply plugin: 'java'
    apply plugin: 'groovy'
    dependencies {
        testCompile 'org.codehaus.groovy:groovy-all:2.3.11',
            'org.spockframework:spock-maven:0.7-groovy-2.0'
    }
}

测试模块 settings.gradle

rootProject.name = 'web'
include 'web'

build.gradle

group 'com.opti'
version '1.0'

apply plugin: 'groovy'
apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    compile(project(':web'))
}

【问题讨论】:

    标签: java testing gradle


    【解决方案1】:

    @Artur 先检查一下: https://docs.gradle.org/current/userguide/java_plugin.html

    似乎 gradle 找不到 web 项目的默认配置。

    您还可以检查运行此命令是否有帮助

    gradle :opti:test
    

    gradle :web:test
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-25
      相关资源
      最近更新 更多