SpringBoot发布提示no main manifest attribute, 解决方法

最近学习SpringBoot的时候,遇到了一个问题,打包的用命令java -jar xxx 发布的时候,提示no main manifest attribute 未有主属性,百度了一下,说是maven需要加入

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

  

但是实际上打包还是一样,可以查看打包大小,没有发生变更,没有效果,后面才发现还要加入

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

                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>

                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                    <mainClass>api.ProviderApplication</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>

这样才是最完整的

原文地址:https://www.cnblogs.com/lhll/p/15774386.html