Deployment Jar package error: no main manifest attribute and spring-boot-maven-plugin report red problem

Problem Description:

Error no main manifest attribute reported when deploying jar package on linux

solve

When packaging the project for the first time, the jar file is very small (the one above is normal).
insert image description here
You need to add configuration to pom.xml: spring-boot-maven-plugin
SpringBoot is generally used to package jar packages with spring-boot-maven -plugin this plug-in, when the plug-in is configured, when running "mvn package" for packaging, it will be packaged into a jar file that can be run directly

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                </configuration>
            </plugin>
        </plugins>
    </build>

Reporting red problem:
All my projects spring-boot-maven-plugin are popular, but the local project can run normally.
The reason for my red report is the lack of a version number. This version number must correspond to the version of the project, otherwise there will still be errors that cannot be found. For example, my project is version 2.3.2
insert image description here
and added to spring-boot-maven-plugin

 <version>2.3.2.RELEASE</version>

After the red issue is resolved,
insert image description here
it can be repackaged and deployed.


jar package deployment reference:
https://blog.csdn.net/weixin_44732379/article/details/115296564

Guess you like

Origin blog.csdn.net/weixin_44732379/article/details/115321514