springboot初学遇到的问题小结

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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值