没有找到包org.slf4j的gradle

时间:2016-08-09 17:01:12

标签: gradle

当我尝试将以下内容添加到我的依赖项中时,我收到一条错误消息“无法找到方法编译<>参数[log4j:log etc ....]

compile 'log4j:log4j:1.2.17'
compile 'org.slf4j:slf4j-api:1.7.5'
compile 'org.slf4j:slf4j-log4j12:1.7.5'

脚本

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'net.saliman:gradle-cobertura-plugin:2.3.1'
    }
}
repositories {
    mavenCentral()
}
configurations {
    junitAnt
}
dependencies {
    compile 'log4j:log4j:1.2.17'
    compile 'org.slf4j:slf4j-api:1.7.5'
    compile 'org.slf4j:slf4j-log4j12:1.7.5'
    junitAnt 'junit:junit:4.8.2'
    junitAnt('org.apache.ant:ant-junit:1.9.2') {
        transitive = false
    }
    junitAnt('org.apache.ant:ant-junit4:1.9.2') {
        transitive = false
    }
}

apply plugin: net.saliman.gradle.plugin.cobertura.CoberturaPlugin
apply plugin: 'java'
version = 1.0
apply plugin: 'war'

sourceSets {
    main {
        java { srcDir 'src' }
        resources { srcDir 'src' }
        resources { srcDir 'WebContent/WEB-INF/lib' }
    }

    test {
        resources { srcDir 'test' }
    }
}

1 个答案:

答案 0 :(得分:0)

移动此部分:

apply plugin: net.saliman.gradle.plugin.cobertura.CoberturaPlugin
apply plugin: 'java'
version = 1.0
apply plugin: 'war'

build.gradle

的开头