Discuss / Java / 运行jar包报错,Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication

运行jar包报错,Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication

Topic source

spring-boot-thin-layout这个插件最新的版本是1.0.28.RELEASE,插件官方github地址:spring-boot-thin-layout官方GitHub

<plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
              <configuration>
                  <excludeDevtools>true</excludeDevtools>
              </configuration>
              <dependencies>
                  <dependency>
                      <groupId>org.springframework.boot.experimental</groupId>
                      <artifactId>spring-boot-thin-layout</artifactId>
                      <version>1.0.28.RELEASE</version>
                  </dependency>
              </dependencies>
          </plugin>

大家伙如果有遇见报错的,Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication

报错的原因是因为springboot的jar包没有下载下来

解决办法就是把spring-boot-thin-layout这个插件的版本改成1.0.28.RELEASE

然后重新用mvn打包:mvn clean package

然后运行jar包就可以了,java -Dthin.root=. -jar awesome-app.jar

<plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
              <configuration>
                  <excludeDevtools>true</excludeDevtools>
              </configuration>
              <dependencies>
                  <dependency>
                      <groupId>org.springframework.boot.experimental</groupId>
                      <artifactId>spring-boot-thin-layout</artifactId>
                      <version>1.0.28.RELEASE</version>
                  </dependency>
              </dependencies>
          </plugin>

问题解决,谢谢大家的掌声鼓励。

alienation

#2 Created at ... [Delete] [Delete and Lock User]

老哥稳的


  • 1

Reply