gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 08:53:28 25 4
gpt4 key购买 nike

我正在关注这个 guide我已经按照他们的说明设置了我的 build.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
}
}
}
}

最佳答案

他们在 git 中有更新到最新的例子 https://github.com/linkedin/rest.li/tree/master/examples/quickstart用以下代码替换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()
}
}

关于java - Rest.li gradle 配置错误规范未知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29787552/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com