展开
拓展 关闭
订阅号推广码
GitHub
视频
公告栏 关闭

springboot常见错误

  • 错误1:运行项目后报如下错误

  • 解决方案

  • 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb

  • 解决方案:在pom.xml中添加如下

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
  • 错误3:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
  • 错误原因:环境配置错误,jdk配置不一致
  • 解决方案
# pom.xml
<properties>
<java.version>8</java.version>
</properties>

  • 右键 > Project Structure

  • 错误4:Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a

  • 错误原因:idea环境中jdk版本不一致

  • 解决方案




  • 错误5:导入依赖后依赖报红

# 解决方案:可将依赖下载到本地后导入项目
参考:https://www.cnblogs.com/JCodeOcean/p/12516327.html
  • 错误6:spring boot项目中启动按钮变灰,或者在启动类中启动没反应
解决方案1:取消idea插件中的groovy
参考csdn:https://blog.csdn.net/qq_26582185/article/details/104724579
解决方案2:spring boot项目启动按钮变灰,maven>install
  • 错误7:spring boot项目启动时报错:Application run failed
错误原因:当我们spring boot项目中引入了MySQL、mybatis等依赖,且yml中配置了数据源等,但业务类中暂时没有使用到,因为spring boot自动注入的特性,启动项目后会报错,解决方案是暂时排除数据源等配置
解决方案:在启动类添加@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
  • 错误8:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on
# 解决方案:在pom.xml中添加插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
  • 错误9:SpringBoot打包后的jar,执行报错:没有主清单属性
# pom.xml中添加如下
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.3.RELEASE</version>
<configuration>
<mainClass>com.hoymin.gmall.gateway.GatewayMain8888</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
posted @   DogLeftover  阅读(363)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
· 提示词工程——AI应用必不可少的技术
历史上的今天:
2021-07-24 CentOS_Server with GUI入门
点击右上角即可分享
微信分享提示