由于运行build.gradle文件而无法引导运行

时间:2019-10-14 22:15:43

标签: java spring spring-boot gradle

我是Spring世界的新手,只是将pom.xml更新为用于管理所有依赖项的gradle。

gradle被社区抛弃了吗? 另外,此错误的可能根本原因是什么。

刚刚意识到Spring Boot包含许多令人困惑的错误消息。我真的不认为这种错误消息会帮助任何开发人员。 对这种错误有任何想法或方向吗?

我唯一知道的是我将pom.xml更改为gradle并手动迁移了配置文件。 非常感谢!

  

线程“ main”中的异常java.lang.AbstractMethodError:接收器类org.springframework.boot.context.config.ConfigFileApplicationListener没有定义或继承已解析方法的实现abstractsupportsSourceType(Ljava / lang / Class;)Z org.springframework.context.event.SmartApplicationListener接口。

Gradle

buildscript {
    ext {
        springBootVersion = '2.1.9.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'dev.15house'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}


dependencies {
    compile group: 'org.modelmapper', name: 'modelmapper', version: '2.1.1'
    compile group: 'org.springframework', name: 'spring-context', version:'4.3.2.RELEASE'
    compile group: 'org.springframework', name: 'spring-webmvc', version:'4.3.2.RELEASE'
    compile("org.springframework.boot:spring-boot-starter-jetty:1.3.5.RELEASE")
    compile("org.springframework.boot:spring-boot-starter-web:1.3.5.RELEASE")
    compile('mysql:mysql-connector-java')
    compile('org.springframework.boot:spring-boot-starter')
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile('org.springframework.boot:spring-boot-starter-test')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.restdocs:spring-restdocs-mockmvc')
    compile('org.springframework.security:spring-security-test')
    implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version:'2.9.4'
    implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version:'2.9.4'
    implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.9.4'
    runtime group: 'org.webjars', name: 'angularjs', version:'1.5.7'
    runtime group: 'org.webjars', name: 'bootstrap', version:'3.3.7'
}

调试日志

> Task :bootRun FAILED
Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.springframework.boot.context.config.ConfigFileApplicationListener does not define or inherit an implementation of the resolved method abstract supportsSourceType(Ljava/lang/Class;)Z of interface org.springframework.context.event.SmartApplicationListener.
        at org.springframework.context.event.GenericApplicationListenerAdapter.supportsSourceType(GenericApplicationListenerAdapter.java:79)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.supportsEvent(AbstractApplicationEventMulticaster.java:282)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:214)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:185)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121)
        at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76)
        at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53)
        at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:342)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
        at dev.house.XprojApplication.main(XprojApplication.java:14)

1 个答案:

答案 0 :(得分:0)

我建议您根据here的需要生成项目。

Here您具有所需的依赖关系。

这是生成的build.gradle

$.getJSON('/public/courseinfo.json', function(info){

        var x = some_function(courses, info);

    });