SpringBoot-0.0.1-SNAPSHOT.jar中没有主清单属性

Maven 工程 java -jar 时提示 xxx-SNAPSHOT.jar 中没有主清单属性

issue

启动 jar 包命令:

java -jar xxx.jar

image-20230514234841724.

SpringBoot-0.0.1-SNAPSHOT.jar 中没有主清单属性



resolve

<skip> 标签的问题❗❗❗

pom.xml 文件

<?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>
    <groupId>com.rnny</groupId>
    <artifactId>SpringBoot</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>SpringBoot</name>
    <description>SpringBoot</description>
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <spring-boot.version>2.6.13</spring-boot.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot.version}</version>
                <configuration>
                    <mainClass>com.rnny.Application</mainClass>
                    <!-- 
		     issue:SpringBoot-0.0.1-SNAPSHOT.jar 中没有主清单属性

		     resolve:① 注释掉,或者 ② 将 skip 值改为 false 
		    -->
                    <!--<skip>true</skip>-->
                </configuration>
                <executions>
                    <execution>
                        <id>repackage</id>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


扩展知识

maven pluginconfigurationskip 标签

maven 插件配置设置.

Maven Quick Start.


<skip>true</skip>

image-20230515231936530.


<skip>false</skip>

image-20230515232259917.

posted @ 2023-05-15 23:46  软柠柠吖  阅读(1799)  评论(1编辑  收藏  举报