STS啓動Spring Boot服務的時候無法啓動,報錯,錯誤: 找不到或無法加載主類的解決辦法

在使用STS(Spring Tools Suite)開發Spring Boot應用的時候,一般來說,只要在pom.xml中的指定SpringBoot的啓動類,
<properties>
        <start-class>com.XXXX.Application</start-class>
</properties>
然後選中項目,右鍵Debug As 或者Run As 選擇Spring Boot App即可啓動服務,但升級了一次STS以後所有服務都無法啓動報錯,錯誤: 找不到或無法加載主類的解決辦法,這是因爲找不到classpath下的文件造成的。
解決辦法是,右鍵Debug As 選中Debug Configurations的Spring Boot App中選中項目,再Classpath選項卡中,最下面選中 Use temporary JAR to specify classpath(to avoid classpath length limitations)選項,這個時候再啓動服務就可以正常啓動了file

這個配置有點像IDEA中的
Command line is too long. Shorten command line for xxxApplication or also for Spring Boot default configuration
在.idea 文件夾中打開workspace.xml文件找到<component name="PropertiesComponent">,在標籤里加一行  <property name="dynamic.classpath" value="true" />  
 

發佈了18 篇原創文章 · 獲贊 21 · 訪問量 10萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章