Java Rest.li gradle配置错误规范未知

Java Rest.li gradle配置错误规范未知,java,intellij-idea,gradle,rest.li,Java,Intellij Idea,Gradle,Rest.li,我按照他们的指示安装了build.gradle,但是当我运行“grade build”时,我得到了以下错误 'No such property: spec for class:org.gradle.api.internal.project.DefaultProject_Decorated' 我假设它引用的是构建文件中的行 'dataTemplateCompile spec.product.pegasus.data' 但我无法确定为什么 apply plugin: 'idea' apply pl

我按照他们的指示安装了build.gradle,但是当我运行“grade build”时,我得到了以下错误

'No such property: spec for class:org.gradle.api.internal.project.DefaultProject_Decorated'
我假设它引用的是构建文件中的行 'dataTemplateCompile spec.product.pegasus.data' 但我无法确定为什么

apply plugin: 'idea'
apply plugin: 'eclipse'

def pegasusVersion = "1.24.1"

spec = [
        "product": [
                "pegasus": [
                        "data"                 : "com.linkedin.pegasus:data:" + pegasusVersion,
                        "generator"            : "com.linkedin.pegasus:generator:" + pegasusVersion,
                        "restliClient"         : "com.linkedin.pegasus:restli-client:" + pegasusVersion,
                        "restliServer"         : "com.linkedin.pegasus:restli-server:" + pegasusVersion,
                        "restliTools"          : "com.linkedin.pegasus:restli-tools:" + pegasusVersion,
                        "pegasusCommon"        : "com.linkedin.pegasus:pegasus-common:" + pegasusVersion,
                        "restliCommon"         : "com.linkedin.pegasus:restli-common:" + pegasusVersion,
                        "r2"                   : "com.linkedin.pegasus:r2:" + pegasusVersion,
                        "restliNettyStandalone": "com.linkedin.pegasus:restli-netty-standalone:" + pegasusVersion
                ]
        ]
]

buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
    }

    dependencies {
        classpath group: 'com.linkedin.pegasus', name: 'gradle-plugins', version: '1.15.9'
    }
}

subprojects {
    apply plugin: 'maven'
    apply plugin: 'idea'
    apply plugin: 'eclipse'

    sourceCompatibility = JavaVersion.VERSION_1_6 // or 1_7

    afterEvaluate {
        // add the standard pegasus dependencies wherever the plugin is used
        if (project.plugins.hasPlugin('pegasus')) {
            dependencies {
                dataTemplateCompile spec.product.pegasus.data
                restClientCompile spec.product.pegasus.restliClient
            }
        }
    }
}

他们已经更新了git中的最新示例 用以下代码替换build.gradle文件

// add rest.li's gradle plugins so they can be used throughout project
buildscript {
 repositories {
mavenLocal()
mavenCentral()
}
dependencies {
  classpath 'com.linkedin.pegasus:gradle-plugins:1.15.9'
}
}

task wrapper(type: Wrapper) {
 gradleVersion = '1.12'
}

 final pegasusVersion = '1.15.9'
 ext.spec = [
    'product' : [
            'pegasus' : [
                    'data' : 'com.linkedin.pegasus:data:' + pegasusVersion,
                    'generator' : 'com.linkedin.pegasus:generator:' + pegasusVersion,
                    'restliCommon' : 'com.linkedin.pegasus:restli-common:' + pegasusVersion,
                    'restliClient' : 'com.linkedin.pegasus:restli-client:' + pegasusVersion,
                    'restliServer' : 'com.linkedin.pegasus:restli-server:' + pegasusVersion,
                    'restliTools' : 'com.linkedin.pegasus:restli-tools:' + pegasusVersion,
                    'gradlePlugins' : 'com.linkedin.pegasus:gradle-plugins:' + pegasusVersion,
                    'restliNettyStandalone' : 'com.linkedin.pegasus:restli-netty-standalone:' + pegasusVersion,
                    'restliServerStandalone' : 'com.linkedin.pegasus:restli-server-standalone:' + pegasusVersion
            ]
    ]
]

allprojects {
  apply plugin: 'idea'
  apply plugin: 'eclipse'
}

subprojects {
 apply plugin: 'maven'

  afterEvaluate {
  if (project.plugins.hasPlugin('java')) {
  sourceCompatibility = JavaVersion.VERSION_1_6
   }

   // add the standard pegasus dependencies wherever the plugin is used
   if (project.plugins.hasPlugin('pegasus')) {
     dependencies {
    dataTemplateCompile spec.product.pegasus.data
    restClientCompile spec.product.pegasus.restliClient

    // needed for Gradle 1.9+
    restClientCompile spec.product.pegasus.restliCommon
     }
   }
 }

  repositories {
    mavenLocal()
    mavenCentral()
  }
}

我也有同样的问题。但我可以通过将gradle降级到1.8版来实现它。我不知道为什么。我想你应该更新指南,指出这一点。