简体   繁体   English

错误:(56,0)原因:org.gradle.api.tasks.testing.Test_Decorated无法转换为java.lang.Class

[英]Error:(56, 0) Cause: org.gradle.api.tasks.testing.Test_Decorated cannot be cast to java.lang.Class

I have this build.gradle 我有这个build.gradle

apply plugin: 'java'

sourceCompatibility = 1.8
version = '1.0'

repositories {
    mavenCentral()
}

dependencies {
//
//    configurations.all*.exclude(group: 'com.sun.jersey', module: 'jersey-bundle')
//    configurations.all*.exclude(group: 'com.fasterxml.jackson.core', module:'jackson-databind')


    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'

    compile 'com.google.inject:guice:4.0-beta5'
    compile 'com.sun.jersey:jersey-core:1.18.3'
    compile 'com.sun.jersey:jersey-client:1.18.3'

    //testCompile group: 'junit', name: 'junit', version: '4.11'
}


sourceSets {
    main {
        java {
            srcDirs = ['src/main']
        }
    }

    test {
        java {
            srcDirs = ['src/main']
        }
    }
}


test {
    testLogging {
// Show that tests are run in the command-line output
        events 'started', 'passed'
    }
}


task testBaseLineGenerator(type: test) {
    systemProperties['test.single'] = 'BaseLineGenerator'
}

task testTotalLatency(type: test) {
    systemProperties['test.single'] = 'TotalLatencyTest'
}

I get an Intellij error, once I have added: 添加完成后,出现Intellij错误:

task testBaseLineGenerator(type: test) {
    systemProperties['test.single'] = 'BaseLineGenerator'
}

task testTotalLatency(type: test) {
    systemProperties['test.single'] = 'TotalLatencyTest'
}

and I get this error: 我得到这个错误:

Error:(56, 0) Cause: org.gradle.api.tasks.testing.Test_Decorated cannot be cast to java.lang.Class
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

tried the two options it suggests, but it didn't help. 尝试了它建议的两个选项,但没有帮助。

I managed to solve my problem: 我设法解决了我的问题:

I changed to task testBaseLineGenerator(type: Test) { 我改为task testBaseLineGenerator(type: Test) {

Test instead of test Test代替test

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 测试DAO时出错:sun.reflect.generics.reflectiveObjects.TypeVariableImpl无法强制转换为java.lang.Class - Error testing DAOs: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class Gradle错误:无法将java.lang.String强制转换为org.gradle.api.artifacts.Configuration - Gradle error: java.lang.String cannot be cast to org.gradle.api.artifacts.Configuration “无法转换为java.lang.Class”,即:哪种类型不是类 - “Cannot be cast to java.lang.Class”, namely: which type is not a class Java:ClassCastException-无法将java.lang.Class强制转换为 - Java: ClassCastException - java.lang.Class cannot be cast to 找不到符号[ERROR]符号:方法getlogger(java.lang.Class <org.first.FirstMaven.App> ) - cannot find symbol [ERROR] symbol: method getlogger(java.lang.Class<org.first.FirstMaven.App>) org.gradle.initialization.DefaultSettings_Decorated无法转换为org.gradle.api.internal.project.ProjectInternal - org.gradle.initialization.DefaultSettings_Decorated cannot be cast to org.gradle.api.internal.project.ProjectInternal java.lang.ClassCastException:无法将java.lang.Class强制转换为java.lang.reflect.ParameterizedType - java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType class java.lang.Class cannot be cast to class java.lang.reflect.Parameterized - class java.lang.Class cannot be cast to class java.lang.reflect.Parameterized How to fix java.lang.ClassCastException: java.lang.Class cannot be cast to java.util.Map - How to fix java.lang.ClassCastException: java.lang.Class cannot be cast to java.util.Map Spring,CXF,java.lang.Class无法转换为[Ljava.lang.Class; - Spring, CXF, java.lang.Class cannot be cast to [Ljava.lang.Class;
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM