• spring boot 打包问题


    [INFO] Final Memory: 17M/225M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE:repackage (default) on project demo-service: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE:repackage failed: Unable to find main class -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

    Process finished with exit code 1

    出现这种错误的原因是

    <build>
    <plugins>
    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
    </plugins>
    </build>
    这个插件,这里引入了spring-boot-maven-plugin,打包时会去扫描项目main方法入口,也就是说引入该配置,你就必须在项目src/main/java/下创建一个spring-boot启动类:

    解决方案:

    1. 添加spring-boot启动类。

    2. 将pom.xml中的spring-boot-maven-plugin相关配置注释掉

    3. pom.xml中spring-boot-maven-plugin相关配置修改为普通的maven--plugin配置即可。

  • 相关阅读:
    MySQL命令2
    MySQL命令1
    前端之HTML1
    linux命令之df dh
    python call java jar
    redis-py中的坑
    YARN应用程序的开发步骤
    Yarn的服务库和事件库使用方法
    SSH无密码验证
    在centos 6.5 在virtual box 上 安装增强版工具
  • 原文地址:https://www.cnblogs.com/liubaihui/p/8966066.html
Copyright © 2020-2023  润新知