首页 > 其他分享 >springboot jar打包 no main manifest attribute

springboot jar打包 no main manifest attribute

时间:2022-09-25 22:57:21浏览次数:94  
标签:springboot no spring boot jar maven repackage attribute plugin

有2种方式

  • 使用mvn

利用以下命令进行打包的

mvn compile

就是要先编译进来,才能把项目中的class文件加进来
之后执行以下代码

mvn package spring-boot:repackage
  • 使用spring-boot maven-plugin

https://docs.spring.io/spring-boot/docs/2.7.4/maven-plugin/reference/htmlsingle/

Packaging Executable Archives
The plugin can create executable archives (jar files and war files) that contain all of an application’s dependencies and can then be run with java -jar.

Packaging an executable archive is performed by the repackage goal, as shown in the following example:

<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>

标签:springboot,no,spring,boot,jar,maven,repackage,attribute,plugin
From: https://www.cnblogs.com/liujw2001/p/16729292.html

相关文章