Maven打包只有几十K,运行报错no main manifest attribute解决方案

导读:本篇文章讲解 Maven打包只有几十K,运行报错no main manifest attribute解决方案,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

Maven打包只有几十K,运行报错no main manifest attribute解决方案

问题背景

上午打包还好好的,下午就报错了:

no main manifest attribute

解决方案

1 这个时候去看一下jar的大小,你会发现,原来是有几十KB,所以不能启动
Maven打包只有几十K,运行报错no main manifest attribute解决方案

2 主要是出在maven的问题上,写法方式是父类模块和子模块都引入了Maven插件,需要把父类模块的maven插件给去掉

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>cn.plus</groupId>
    <artifactId>server</artifactId>
    <version>0.0.1</version>
    <packaging>pom</packaging>

    <modules>
        <module>common</module>
        <module>p</module>
        <module>j</module>
        <module>ap</module>
    </modules>

    <build>
        <plugins>
<!--            <plugin>-->
<!--                <groupId>org.springframework.boot</groupId>-->
<!--                <artifactId>spring-boot-maven-plugin</artifactId>-->
<!--                <configuration>-->
<!--                    <classifier>bootJar</classifier>-->
<!--                    <mainClass>cn.catalystplus.facade.Application</mainClass>-->
<!--                    <outputDirectory>${project.build.directory}/root</outputDirectory>-->
<!--                    <excludes>-->
<!--                        <exclude>-->
<!--                            <groupId>org.projectlombok</groupId>-->
<!--                            <artifactId>lombok</artifactId>-->
<!--                        </exclude>-->
<!--                    </excludes>-->
<!--                </configuration>-->
<!--                <executions>-->
<!--                    <execution>-->
<!--                        <goals>-->
<!--                            <goal>repackage</goal>-->
<!--                        </goals>-->
<!--                    </execution>-->
<!--                </executions>-->
<!--            </plugin>-->
        </plugins>
    </build>
</project>

作为程序员第 235 篇文章,每次写一句歌词记录一下,看看人生有几首歌的时间,wahahaha …
Maven打包只有几十K,运行报错no main manifest attribute解决方案Maven打包只有几十K,运行报错no main manifest attribute解决方案Maven打包只有几十K,运行报错no main manifest attribute解决方案

Lyric: 我们笑得很甜

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/110640.html

(0)
小半的头像小半

相关推荐

极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!