IDEA maven 编译运行:找不到或无法加载主类 com.nan.web.ControllerApplication

图片描述

我运行一个springboot项目
Run Configuration配置如上图,
参数为
-X -pl com.nan:web -am clean package -Dmaven.test.skip=true -Poffice

跑起来后,结果是:
Connected to the target VM, address: '127.0.0.1:63487', transport: 'socket'
错误: 找不到或无法加载主类 com.nan.web.ControllerApplication
Disconnected from the target VM, address: '127.0.0.1:63487', transport: 'socket'

Process finished with exit code 1

但是如果我Run Configuration配置为build,跑起来就没问题
或者build之后,将配置改为Run Maven Goal如上参数
且不删除target,也能运行
怎么回事?

阅读 14.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题