Run Spring-boot's main using IDE

前端 未结 9 1951
灰色年华
灰色年华 2020-11-30 01:51

I have a spring-boot application that needs to:

  • Be deployable as a war in a servlet container
  • Be runnable via `mvn spring-boot:run``

I\

9条回答
  •  再見小時候
    2020-11-30 02:23

    I believe this could be related to https://youtrack.jetbrains.com/issue/IDEA-107048

    IntelliJ IDEA is not injecting the provided dependencies into the CLASSPATH and as Andy stated this is why spring is unable to create the embedded servlet container.

    They have a feature request since 2005 about this: https://youtrack.jetbrains.com/issue/IDEABKL-99

    Workarounds mentioned in the comments includes having a fake module with the necessary libs and using it as classpath, using the -Xbootclasspath JVM argument or using custom maven profiles for running (compiled) vs building (provided).

提交回复
热议问题