找不到合适的主类,请添加’mainClass’属性 -可能是错误的类路径?

huangapple go评论61阅读模式
英文:

Unable to find a suitable main class, please add a 'mainClass' property -wrong classpath maybe?

问题

我在运行 mvn spring-boot:run 时收到上述错误。
更具体地说,mvn spring-boot:run 错误
经过一些研究,我发现我需要在 pom 中像这样指定主类 pom property-start-class,我的主类路径是:path
但我仍然得到这个错误:exception
我在类路径(classpath)方面做错了什么吗?

英文:

I receive the above error when running mvn spring-boot:run
more specific mvn spring-boot:run error
after some research i found out that i have to specify the main class inside pom like this pom property-start-class the path of my mainclass is:path
and i still get this error:exception
am i doing something wrong with the classpath?

答案1

得分: 3

你可以从项目的根目录运行以下命令:

mvn clean package spring-boot:repackage
英文:

you can run this command from the root project:

mvn clean package spring-boot:repackage 

答案2

得分: 0

没有问题的mvn spring-boot:run

但是如果你遇到错误,先运行mvn clean install

英文:

Nothing wrong with mvn spring-boot:run

However if you are getting an error, just run mvn clean install first

huangapple
  • 本文由 发表于 2020年9月3日 01:28:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/63710710.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定