[root@linuxlocalhost app]# java -jar jardemo1-0.0.1-SNAPSHOT.jar jardemo1-0.0.1-SNAPSHOT.jar中没有主清单属性
[root@linuxlocalhost app]# java -jar jardemo-0.0.1-SNAPSHOT.jar 错误: 找不到或无法加载主类 com.example.MainClass
解决方法:
在spring-boot-maven-plugin插件中去掉<skip>标签,因为此标签会跳过此插件的执行 导致无法生成可执行的jar
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration> <mainClass>com.example.jardemo1.Jardemo1Application</mainClass>
<skip>true</skip> --去掉这一行
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals> <goal>repackage</goal> ---这一段也是必须的 要放在此插件里面
</goals>
</execution>
</executions>
</plugin>