gpt4 book ai didi

spring - Spring Cloud Angel.SR4和Grails 3.0.9无法正常工作

转载 作者:行者123 更新时间:2023-12-02 15:21:43 24 4
gpt4 key购买 nike

也许您可以帮助我解决这个问题:

我正在创建一个Grails项目3.0.10版本,并希望该项目作为Eureka Client运行。我正在使用Spring Boot 1.3.1.RELEASE,并且正在尝试使用Spring Cloud Angel.SR4版本。

我有一个运行良好的Java项目,但是当尝试应用依赖项并运行我的Grails应用程序时,它会引发一些问题:

这是我用于项目的gradle.build文件:

buildscript {
ext {
grailsVersion = project.grailsVersion
// I have added this line
springBootVersion = '1.3.1.RELEASE'
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails.plugins:hibernate:4.3.10.5"

}
}

plugins {
id "io.spring.dependency-management" version "0.4.2.RELEASE"
}

version "0.1"
group "demograilsclient"

apply plugin: "spring-boot"
apply plugin: "war"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-web"

ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
}

repositories {
// I have added those two lines
mavenCentral()
jcenter()

mavenLocal()
maven { url "https://repo.grails.org/grails/core" }

// I have added those two lines
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}

dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
// I have added this line
mavenBom 'org.springframework.cloud:spring-cloud-starter-parent:Angel.SR4'
}
applyMavenExclusions false
}

dependencies {

// Spring cloud dependencies
compile("org.springframework.cloud:spring-cloud-starter-config")
compile("org.springframework.cloud:spring-cloud-starter-eureka")

// not modified
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-plugin-url-mappings"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-datasource"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-plugin-async"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-logging"

compile "org.grails.plugins:hibernate"
compile "org.grails.plugins:cache"
compile "org.hibernate:hibernate-ehcache"

runtime "com.h2database:h2"

testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"

console "org.grails:grails-console"
}

task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}


我的Application.yml是:

server:
port: 0

info:
component: Grails App

eureka:
instance:
lease-renewal-interval-in-seconds: 10
metadata-map:
instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${random.value}}}
client:
registry-fetch-interval-seconds: 5
service-url:
defaultZone: http://localhost:8761/eureka/

---



grails:
profile: web-api
codegen:
defaultPackage: demograilsclient
info:
app:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
spring:
groovy:
template:
check-template-location: false


.....
... contine >>


用于grails框架启动应用程序的主类是这样的:

package demograilsclient

import grails.boot.GrailsApp
import grails.boot.config.GrailsAutoConfiguration

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.cloud.netflix.eureka.EnableEurekaClient


@SpringBootApplication
@EnableEurekaClient
class Application extends GrailsAutoConfiguration {
static void main(String[] args) {
GrailsApp.run(Application, args)
}
}


当我执行时:

grails run-app


它引发以下错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
> A problem occurred starting process 'command 'C:\program files\Java\jdk1.8.0_6
0\bin\java.exe''

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

Total time: 20.374 secs


也许你可以帮我

谢谢 !!

最佳答案

Angel。*和Spring Boot 1.3.x不兼容。

关于spring - Spring Cloud Angel.SR4和Grails 3.0.9无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34501851/

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