org.springframework.boot.web.support does not exist

前端 未结 4 1359
一向
一向 2021-02-12 09:48

I\'m changing build systems from maven to gradle for a spring boot project. I get this stacktrace

19:03:08: Executing external task \'bootRun\'...
/home/dac/proj         


        
4条回答
  •  北荒
    北荒 (楼主)
    2021-02-12 10:12

    It's probably an import issue in your source code - your Gradle build script uses Spring Boot 1.3.6.RELEASE in which SpringBootServletInitializer has the following fully qualified name:

    org.springframework.boot.context.web.SpringBootServletInitializer 
    

    Your Maven pom.xml, however, uses Spring Boot 1.4.0.BUILD-SNAPSHOT, in which the package name was changed to:

    org.springframework.boot.web.support.SpringBootServletInitializer
    

    So if you go to your SampleJettyJspApplication and change the import to

    import org.springframework.boot.context.web.SpringBootServletInitializer;
    

    everything should be fine.

    Alternatively, you could alter your Gradle build script to import 1.4.0.BUILD-SNAPSHOT, but that would require adding Spring's snapshot repository:

    buildscript {
        repositories {
            maven.url "http://repo.spring.io/snapshot"
            mavenCentral()
        }
    
        dependencies {
            classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT")
        }
    }
    

提交回复
热议问题