目录
1、打包完运行时遇到:XXX-SNAPSHOT.jar中没有主清单属性
pom.xml增加
<!--解决:-SNAPSHOT.jar中没有主清单属性 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.2</version>
</dependency>
并增加build
<build>
<plugins>
<!--解决:-SNAPSHOT.jar中没有主清单属性 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<!--指定main-->
<mainClass>com.dbc.demo.DemoApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
2、在运行jar文件时报错 No active profile set, falling back to default profiles: default
在pom.xml文件中增加
<!-- 解决 No active profile set, falling back to default profiles: default
增加之时注意要增加版本信息-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.4.2</version>
</dependency>
3、参考 :https://blog.csdn.net/qq_38534524/article/details/112382518
For artifact {org.springframework.boot:spring-boot-starter-web:null:jar}: The version cannot be empty 错
在pom.xml文件引用中遇到的。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.4.2</version>
<!--For artifact {org.springframework.boot:spring-boot-starter-web:null:jar}: The version cannot be empty 增加下面type部分-->
<type>pom</type>
</dependency>