原文

Linux执行Jar包报错: no main manifest attribute

在服务器上面使用java -jar执行jar包的时候,报如下错误

在这里插入图片描述

需要在pom.xml中加入以下配置

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
  
    <configuration>
         <includeSystemScope>true</includeSystemScope>
         <mainClass>com.cs.xxxxApplication</mainClass>
    </configuration>
</plugin>

然后重新打包,再执行,就没啥问题了

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐