属性不能应用于&#39;(groovy.lang.Closure <java.lang.object>)&#39;

时间:2016-08-02 13:06:12

标签: java android android-studio groovy

我无法为以下代码修复这些警告:

属性不能应用于&#39;(groovy.lang.Closure)

org.gradle.api.Task&#39;中的

属性不能应用于&#39;(java.lang.String,java.lang.String)

  sonarqube {
        properties {
            property "sonar.host.url", "http://localhost:9000"
            property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
            property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
        }
    }

尝试了下面提到的所有解决方案但非工作正常。 'dependencies' cannot be applied to '(groovy.lang.Closure)'

任何人都知道原因。

提前致谢。

编辑

import org.gradle.internal.os.OperatingSystem

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'findbugs'
apply from: '../jacoco.gradle'
apply plugin: 'spoon'
apply plugin: 'org.sonarqube'
apply plugin: 'net.researchgate.release'
apply plugin: 'io.fabric'
apply from: 'versioning.gradle'
apply plugin: 'maven-publish'

ext {
    appName = "xxxx"
    appDesc = "xxxx"
}

android {
    compileSdkVersion 24
    buildToolsVersion '24.0.1'
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.eurocarparks.exemption"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode buildVersionCode()
        versionName version
    }

    signingConfigs {
        release {


        }
    }

    productFlavors {
        demo {

        }
        tst {

        }
        uat {

        }
        production {

        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        debug {
            debuggable = true
            testCoverageEnabled = true
        }
    }

    lintOptions {
        abortOnError false
    }

    packagingOptions {
        exclude 'NOTICE'
        exclude 'LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "5g"
    }
}


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:24.1.1'
    compile 'com.android.support:appcompat-v7:24.1.1'

    // JSON
    compile 'com.fasterxml.jackson.core:jackson-core:2.6.3'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.6.3'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.3'
    // RESTful
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp:2.4.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
    compile 'com.squareup.retrofit:converter-jackson:1.9.0'
    compile('com.squareup.retrofit:converter-simplexml:1.6.1') {
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'stax', module: 'stax'
        exclude group: 'xpp3', module: 'xpp3'
    }
    // Utilities
    compile 'com.google.guava:guava:19.0'
    // Event bus
    compile 'de.greenrobot:eventbus:2.4.0'
    // Database
    compile 'com.couchbase.lite:couchbase-lite-android:1.1.0'
    // Dependency injection
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.google.dagger:dagger:2.0.1'
    apt 'com.google.dagger:dagger-compiler:2.0.1'
    provided 'org.glassfish:javax.annotation:10.0-b28'
    // Commons IO
    compile 'commons-io:commons-io:2.4'
    // Unit test
    testCompile 'org.robolectric:robolectric:3.0'

    testCompile 'org.robolectric:shadows-support-v4:3.0'

    testCompile 'junit:junit:4.12'

    testCompile 'org.mockito:mockito-core:2.0.89-beta'
    testCompile 'org.assertj:assertj-core:1.7.1'
    testCompile 'com.google.dagger:dagger:2.0.1'
    testCompile 'org.skyscreamer:jsonassert:1.2.3'
    if (OperatingSystem.current().isMacOsX()) {
        println "OS: MacOsX"
        testCompile 'com.couchbase.lite:couchbase-lite-java-native-macosx:1.1.0'
    } else if (OperatingSystem.current().isLinux()) {
        println "OS: Jenkins"
        testCompile 'com.couchbase.lite:couchbase-lite-java-native-jenkins:1.1.0'
    } else if (OperatingSystem.current().isWindows()) {
        println "OS: Windows"
        testCompile 'com.couchbase.lite:couchbase-lite-java-native-windows:1.1.0'
    }
    testCompile('com.couchbase.lite:couchbase-lite-java:1.1.0') {
        exclude module: "couchbase-lite-java-native"
        exclude group: "com.fasterxml.jackson.core"
        exclude group: "commons-logging"
    }
    // Instrumentation test
    androidTestCompile 'junit:junit:4.12'
    androidTestCompile 'org.assertj:assertj-core:1.7.1'
    androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.6.0'
    androidTestCompile('com.squareup.spoon:spoon-runner:1.6.1') {
        exclude group: "commons-logging"
        exclude group: 'com.google.code.gson'
        exclude module: 'guava'
    }
    androidTestCompile('com.squareup.spoon:spoon-client:1.1.10') {
        exclude group: 'com.google.code.gson'
    }

    // Monitoring
    compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
        transitive = true;
    }

}



spoon {
    debug = true
    if (project.hasProperty("spoonDeviceSerials")) devices = [spoonDeviceSerials]
}


sonarqube {
    properties {
        property "sonar.host.url", "http://localhost:9000"
        property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
        property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"

    }
}

release {
    preTagCommitMessage = '[Release] - pre tag commit: '
    tagCommitMessage = '[Release] - creating tag: '
    newVersionCommitMessage = '[Release] - new version commit: '
    buildTasks = ['assembleTst', 'assembleUat', 'assembleProduction']
    git {
        requireBranch = ''
        pushToCurrentBranch = true
    }
}

afterReleaseBuild.dependsOn publish

publishing {
    repositories {    }
}

0 个答案:

没有答案