SpringBoot項目Pom文件的基本配置方式
更新時間:2023年06月17日 08:43:57 作者:呂家二公子
這篇文章主要介紹了SpringBoot項目Pom文件的基本配置方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
SpringBoot項目Pom文件的配置
<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<!-- pom模板版本 -->
<modelVersion>4.0.0</modelVersion>
<!-- 父項目 -->
-<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<!-- 項目坐標及版本-->
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<!-- 依賴版本限定 -->
-<properties>
<java.version>1.8</java.version>
</properties>
<!-- 項目依賴 -->
-<dependencies>
-<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
-<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
-<exclusions>
-<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<!-- 項目構建插件 -->
-<build>
-<plugins>
<!-- 編譯打包插件 -->
-<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>創(chuàng)建SpringBoot工程,pom.xml文件報紅
我總共試了三種方法,對我而言第三種才有效。
如圖:

然后在網上找了一大堆如何解決springboot的pom.xml文件報紅。
第一種
有說去修改maven的下conf文件夾下的settings.xml的三個主要信息

第二種
修改idea下的maven配置信息:

第三種
打開maven目錄下的conf ,再打開 settings.xml。在mirrors里面寫入:
`<!-- 阿里云鏡像 --> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>central</id> <name>Maven Repository Switchboard</name> <url>http://repo1.maven.org/maven2/</url> <mirrorOf>central</mirrorOf></mirror> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> <mirror> <id>ibiblio</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url> </mirror> <!-- 中央倉庫在中國的鏡像 --> <mirror> <id>maven.net.cn</id> <name>oneof the central mirrors in china</name> <url>http://maven.net.cn/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror>
之后還是有些問題,

然后再JV Options內添加:
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true
最后我點擊加載:

總結
以上為個人經驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
關于mybatis callSettersOnNulls 配置解析
這篇文章主要介紹了關于mybatis callSettersOnNulls 配置,非常不錯,具有一定的參考借鑒價值 ,需要的朋友可以參考下2018-06-06
java開發(fā)分布式服務框架Dubbo服務引用過程詳解
這篇文章主要為大家介紹了java開發(fā)分布式服務框架Dubbo服務引用詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步2021-11-11

