zoukankan      html  css  js  c++  java
  • 在idea中把springboot项目打成jar包遇到的问题(没有主清单属性)(没有内置tomcat)(闪退)

    在idea中把springboot项目打成jar包遇到的问题:没有主清单属性

    也就是你打好的jar包中的META-INF的MANIFEST文件中没有

    Main-Class: org.springframework.boot.loader.JarLauncher
    Start-Class: 入口类权限定名
    Spring-Boot-Classes: BOOT-INF/classes/
    Spring-Boot-Lib: BOOT-INF/lib/

    解决方法:加这个插件(标红的一定要自己加上去,因为spring的官方生成文件没有这个)

    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <executions>
    <execution>
    <goals>
    <goal>repackage</goal>
    </goals>
    </execution>
    </executions>

    </plugin>
    如果还没有解决,就有可能你的pom文件的插件不干净
    idea自己生成的maven项目里pom自带的插件会影响打包
    比如说:
    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
    <pluginManagement/>
    有了这个的项目打jar包时,jar包不会内置tomcat
    这也是明明打好包又没报错为什么用命令打开时会报:没有主清单属性或闪退的原因(没有内置到tomcat)

    所以打包时要确认自己的pom文件中的插件要干净
     <build>
                  <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>repackage</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
        </build>
    
    
    
     
  • 相关阅读:
    Ubuntu在下面LAMP(Linux+Apache+MySQL+PHP) 开发环境的搭建
    直接插入排序、折半插入排序、Shell排序、冒泡排序,选择排序
    java插入字符串
    bash,bg,bind,break,builtin,caller,compgen, complete,compopt,continue,declare,dirs,disown,enable,eval,exec,expo
    socket用法
    org.jsoup.select.Selector
    达达技术
    CentOS 6.4 文件夹打开方式
    shell加法
    shell统计
  • 原文地址:https://www.cnblogs.com/406070989senlin/p/11440715.html
Copyright © 2011-2022 走看看