Rest.li gradle配置错误规格未知

时间:2015-04-22 04:05:18

标签: java intellij-idea gradle rest.li

我正在关注此guide我按照他们的说明设置了我的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
            }
        }
    }
}

1 个答案:

答案 0 :(得分:2)

他们在git中有更新的例子 https://github.com/linkedin/rest.li/tree/master/examples/quickstart 用以下代码替换build.gradle文件

JButton button = new JButton("Start");
      button.addActionListener(new
         ActionListener()
         {
            public void actionPerformed(ActionEvent e)
            {
               Timer t = new Timer(100, new
                     ActionListener()
                     {
                        public void actionPerformed(ActionEvent event)
                        {
                           shape.translate(x, y);
                           label.repaint();
                        }
                     });
               t.start();
            }
         });