弹簧启动 2 和 SCDF / 弹簧流 + gradle 有人成功编译了吗?



我正在尝试编译我的第一个春季云流应用程序,

但。。

所有可用的示例都基于Spring Boot <当我尝试升级Spring引导版本时为2.0.0(还有他的要求(即,解释io.spring.dependency-management)>

并带有以下示例测试类:

@RunWith(SpringRunner.class)
@SpringBootTest
public class SampleAppTest {
@Test
public void contextLoads() {
}
}

即使是构建在 https://start-scs.cfapps.io

Time Source+Rabbit binder starter基于 gradle 和 springboot 2.0.0 由于测试失败而无法编译,异常并出现相同的错误

我也未能找到使用 spring cloud stream 和 spring boot 2 的 github 代码, 所以我的问题是..有人成功地将它们一起使用了吗?如何?

谢谢 弗朗切斯科

也许我发现了问题,缺少此依赖项:

弹簧-云-流-测试-支持

无论如何 我想在某处说,整个项目需要依赖图的摘要,已弃用的版本以及一些使用gradle和kotlin的微服务微示例(有效)

阅读参考后,我去测试我的第一个应用程序,但没有工作,尝试编译 https://github.com/spring-cloud-stream-app-starters/trigger 但没有编译(已经打开了一个问题),在参考中写了使用 Spring 可以为 Bootrap 应用程序流式传输应用程序启动器,但没有找到 spring-boot 2 的示例(我需要 kafka 1.0 binder),

那么这个存储库显然已经过时了(没有提供兼容性图): https://github.com/spring-cloud/spring-cloud-stream-app-starters 说去这里:https://github.com/spring-cloud-stream-app-starters

但是这些项目,比如说针对 1.3 构建,指向这个存储库: http://repo.spring.io/libs-release/org/springframework/cloud/stream/app/而且我在试图弄清楚很久以前发布的 springboot2 有什么工作时遇到了严重的问题,而且似乎也是唯一支持 kafka 1.0 的,伙计们,这是一团糟。

谢谢 弗朗切斯科

-------------------附加说明: 这是我发现的一个不完整的解决方案,因为: 添加

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-test-support</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<scope>test</scope>
</dependency>

适用于从 https://start-scs.cfapps.io 生成的 Maven 项目,并在我最初的问题中提供了详细信息,但是,对格拉德尔不起作用! 所以现在我还在调查..

-----现在使用 GRADLE 编译...阅读下文..

好的,最后我已经弄清楚了如何在我最初的问题中使用指定的依赖项从 https://start-scs.cfapps.io/编译生成的应用程序。 最终的build.gradle文件是:

buildscript {
ext {
springBootVersion = '2.0.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}

dependencies {
compile('org.springframework.cloud:spring-cloud-stream-binder-rabbit')
compile('org.springframework.cloud.stream.app:spring-cloud-starter-stream-source-time')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.cloud:spring-cloud-stream-test-support')
}
dependencyManagement {
imports {
//mavenBom "org.springframework.cloud.stream.app:time-app-dependencies:1.3.1.RELEASE"
mavenBom "org.springframework.cloud.stream.app:time-app-dependencies:2.0.0.BUILD-SNAPSHOT"

//mavenBom "org.springframework.cloud.stream.app:app-starters-core-dependencies:1.3.1.RELEASE"
mavenBom "org.springframework.cloud.stream.app:app-starters-core-dependencies:2.0.0.BUILD-SNAPSHOT"
}
}

希望这可以帮助其他人;)

最新更新