springboot.jar没有主清单属性
时间: 2023-11-08 18:49:47 浏览: 53
当Spring Boot的可执行JAR文件没有主清单属性时,可能有两种可能原因。首先,可能是因为在pom.xml文件中没有引入spring-boot-starter-parent依赖。该依赖封装了打包可执行JAR和WAR的配置。您可以在pom.xml中添加以下代码:
```xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/>
</parent>
```
其次,可能是因为pom.xml中的spring-boot-maven-plugin插件无法找到启动类或者存在多个main方法。您可以尝试手动配置插件,指定启动类。在pom.xml中添加以下代码:
```xml
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.health.shanghai.Application</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
```
通过以上修改,您可以解决Spring Boot JAR没有主清单属性的问题。希望对您有帮助!