我正在启动一个新的grails应用程序,我正在使用grails 5. 2. 0(截至今天的最新版本)
我生成了一个 backbone 使用:
~/grails-5.2.0/bin/grails创建应用程序数据门户--配置文件=React
然而,尝试运行应用程序总是给我以下错误:
配置项目:服务器无法解析重新加载代理JAR:无法解析导入的Maven本体:无法解析外部依赖项org. springframework. boot:spring-boot-dependencies:2.7.0,因为未定义存储库。需要者:项目:服务器
失败:构建完成,但有2次失败。
1:任务失败,出现异常。
- 其中:构建文件".../server/build. gradle"行:20
- 出了什么问题:评估项目":server"时出现问题。
接收器类grails.util.Environment没有定义或继承接口groovy.lang.GroovyObject的解析方法"abstract java. lang. Object getProperty(java. lang. String)"的实现。
- 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获取完整信息。============================================================
2:任务失败,出现异常。
- 出了什么问题:配置项目":server"时出现问题。
无法通知项目评估侦听器。接收器类grails. util. Environment未定义或继承接口groovy.lang.GroovyObject的解析方法"abstract java. lang. Object getProperty(java. lang. String)"的实现。
- 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获取完整信息。============================================================
- 从https://help.gradle.org获取更多帮助
此版本中使用了弃用的Gradle功能,因此与Gradle 7.0不兼容。使用"--warning-mode all"显示各个弃用警告。请访问www.example.comhttps://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
配置在233ms内失败
这是我的settings. gradle的样子include 'client', 'server'
这是我的服务器/build.gradle的外观
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "com.github.node-gradle:gradle-node-plugin:1.3.0"
classpath "org.grails.plugins:hibernate5:7.3.0"
classpath "org.grails.plugins:views-gradle:2.3.2"
}
}
version "0.1"
group "dp"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"com.github.node-gradle.node"
apply plugin:"org.grails.plugins.views-json"
repositories {
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom('org.springframework.boot:spring-boot-dependencies:2.7.0')
}
applyMavenExclusions false
}
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
dependencies {
developmentOnly("org.springframework.boot:spring-boot-devtools")
compileOnly "io.micronaut:micronaut-inject-groovy"
console "org.grails:grails-console"
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-starter-validation"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.grails:grails-core"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
implementation "org.grails:grails-plugin-url-mappings"
implementation "org.grails:grails-plugin-rest"
implementation "org.grails:grails-plugin-codecs"
implementation "org.grails:grails-plugin-interceptors"
implementation "org.grails:grails-plugin-services"
implementation "org.grails:grails-plugin-datasource"
implementation "org.grails:grails-plugin-databinding"
implementation "org.grails:grails-web-boot"
implementation "org.grails:grails-logging"
implementation "org.grails.plugins:cache"
implementation "org.grails.plugins:async"
implementation "org.grails.plugins:hibernate5"
implementation "org.hibernate:hibernate-core:5.6.9.Final"
implementation "org.grails.plugins:views-json"
implementation "org.grails.plugins:views-json-templates"
profile "org.grails.profiles:react"
runtimeOnly "org.glassfish.web:el-impl:2.2.1-b05"
runtimeOnly "com.h2database:h2"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
runtimeOnly "javax.xml.bind:jaxb-api:2.3.1"
testImplementation "io.micronaut:micronaut-inject-groovy"
testImplementation "org.grails:grails-gorm-testing-support"
testImplementation "org.mockito:mockito-core"
testImplementation "io.micronaut:micronaut-http-client"
testImplementation "org.grails:grails-web-testing-support"
testImplementation "org.grails:views-json-testing-support"
testImplementation "org.hibernate.validator:hibernate-validator:6.1.7.Final"
}
bootRun {
ignoreExitValue true
jvmArgs(
'-Dspring.output.ansi.enabled=always',
'-noverify',
'-XX:TieredStopAtLevel=1',
'-Xmx1024m')
sourceResources sourceSets.main
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}
tasks.withType(GroovyCompile) {
configure(groovyOptions) {
forkOptions.jvmArgs = ['-Xmx1024m']
}
}
tasks.withType(Test) {
useJUnitPlatform()
}
这是我的客户端/build.gradle的外观:
plugins {
id "com.github.node-gradle.node" version "1.3.0"
}
node {
version = '10.15.0' // https://nodejs.org/en/
yarnVersion = '1.13.0' // https://yarnpkg.com/en/
download = true
}
task bootRun(dependsOn: 'start') {
group = 'application'
description = 'Run the client app (for use with gradle bootRun -parallel'
}
task start(type: YarnTask, dependsOn: 'yarn') {
group = 'application'
description = 'Run the client app'
args = ['run', 'start']
}
task build(type: YarnTask, dependsOn: 'yarn') {
group = 'build'
description = 'Build the client bundle'
args = ['run', 'build']
}
task test(type: YarnTask, dependsOn: 'yarn') {
group = 'verification'
description = 'Run the client tests'
args = ['run', 'test']
}
task eject(type: YarnTask, dependsOn: 'yarn') {
group = 'other'
description = 'Eject from the create-react-app scripts'
args = ['run', 'eject']
}
2条答案
按热度按时间mepcadol1#
在www.example.com中将grailsGradlePluginVersion从grailsGradlePluginVersion=5.2更改为grailsGradlePluginVersion=5.1.x后,此问题似乎得到了解决gradle.properties
egdjgwm82#
从弃用警告来看,您似乎是使用Gradle 6.9构建的。
Grails 5需要使用Gradle 7。
我不小心使用了
gradle
命令而不是gradlew
,也遇到了同样的问题。gradlew
使用项目Gradle Wrapper中的Gradle版本,但gradle
命令将运行PATH
上的任何Gradle版本(在我的示例中为6.9.2),因此我遇到了相同的异常。对于处于相同情况的其他人:
./gradlew build
gradle wrapper --gradle-version 7.2
来添加一个GRADLE_HOME
环境变量设置为新的安装位置(而不是v6或更早版本的安装),gradle build
应该可以正常工作。