2015-04-22 44 views
2

我跟着這​​我已經安裝我的build.gradle按照他們的指示,但是當我運行'分級構建'我得到以下錯誤。Rest.li gradle配置錯誤規範未知

'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 
      } 
     } 
    } 
} 
+0

我有同樣的問題,更換的build.gradle文件。但是我可以通過將gradle降級到1.8版來實現它。不知道爲什麼。 – user875367

回答

2

他們在混帳 https://github.com/linkedin/rest.li/tree/master/examples/quickstart 更新最新例如,通過下面的代碼

// 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() 
    } 
} 
+0

我認爲你應該更新指南指出。 – user2601010