尝试构建可执行文件 spring 引导 jar 时出错

Error trying to build a executable spring boot jar

我只是尝试使用 Spring Boot 构建可执行 jar,基于 Joel 示例 https://github.com/joeldudleyr3/spring-observable-stream,但我收到以下错误:

exception is java.lang.NoSuchMethodError: org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration.getDefaultRoutingType()Lorg/apache/activemq/artemis/api/core/RoutingType;

在这行代码:

CordaRPCClient(rpcAddress).start(username, password)

Obs.: 通过 JavaExec 任务调用它完美地工作。

这是一个 jar 问题。没有这个方法。此方法已被移动以查找包名称为:org.apache.activemq.artemis 的 jar。在客户端和常见的。在这里不确定,但这是你选择版本 1.X 或 2.X 的罪魁祸首,只需检查哪个版本具有此方法。 在你的 gradle 文件中为客户端和通用版本强制编译为 2.X 版本你会很高兴。

我通过将以下内容添加到我的 build.gradle 文件的 dependencies 块来修复此问题:

dependencies {

    ...

    compile "org.apache.activemq:artemis-commons:2.0.0"
    compile "org.apache.activemq:artemis-core-client:2.0.0"

    ...

}