错误描述

在idea中运行springboot程序时,有时会遇到以下错误:

Command line is too long. Shorten command line for VpclubApplication or also for Spring Boot default configuration.

如图所示:

image-20220509114431753

错误原因

springboot项目启动命令过长

解决方案

方案一:修改工作空间配置

  1. 在项目的.idea目录下找到workspace.xml文件,打开编辑
  2. 找到标签<component name="PropertiesComponent">
  3. 在上述标签下添加一行<property name="dynamic.classpath" value="true" />

image-20220509115210527

对于新版本的idea,这里是以key-value的形式配置的:"dynamic.classpath": "true",

方案二:修改启动项配置

  1. 打开项目的启动项配置
  2. 打开Enviroment 标签
  3. 将Shorten command line选项修改为 JAR manifestclasspath file

image-20220509120017578