繁体   English   中英

插件org.springframework.boot:spring-boot-maven-plugin?

[英]Plugin org.springframework.boot:spring-boot-maven-plugin?

当执行spring-boot代码时,出现以下错误:

无法在项目projectName上执行目标org.springframework.boot:spring-boot-maven-plugin:2.1.2.RELEASE:run(default-cli),无法找到合适的主类,请添加'mainClass'属性

我该如何解决?

将主类添加到插件配置

<build>
  ...
  <plugins>
    ...
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <configuration>
        <mainClass>your.class.with.main.Method</mainClass>
      </configuration>
    </plugin>
    ...
  </plugins>
  ...
</build>

来源: https : //docs.spring.io/spring-boot/docs/current/maven-plugin/usage.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM