maven-3.9.12的conf配置settings.xml

复制代码
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">

  <localRepository>F:\java\repository</localRepository>
  <pluginGroups></pluginGroups>
  <proxies></proxies>
  <servers></servers>

  <mirrors>

    <mirror>
      <id>aliyunmaven</id>
      <mirrorOf>central,jcenter</mirrorOf>
      <name>阿里云公共仓库</name>
      <url>https://maven.aliyun.com/repository/public</url>
    </mirror>
	
   
  </mirrors>
  
  
  

  <!-- 简化 profiles 配置 -->
  <profiles>
    <profile>
      <id>aliyun</id>
      <repositories>
        <repository>
          <id>aliyun</id>
          <name>Aliyun Maven Repository</name>
          <url>https://maven.aliyun.com/repository/public</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <!-- 添加 Maven Central 作为备用 -->
        <repository>
          <id>central</id>
          <name>Maven Central</name>
          <!--  <url>https://repo.maven.apache.org/maven2</url> -->
          <url>https://repo1.maven.org/maven2/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
	  
	 <profile>
      <id>jdk21</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <jdk>21</jdk>
      </activation>
      <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <maven.compiler.compilerVersion>21</maven.compiler.compilerVersion>
      </properties>
    </profile>
  </profiles>

<!-- 激活 profile -->
  <activeProfiles>
    <activeProfile>aliyun</activeProfile>
    <activeProfile>jdk21</activeProfile>
  </activeProfiles>
</settings>

如果依赖一直添加不到idea的external libraries中,可以参考下列几个命令:

复制代码
# 1. 先清理所有
mvn clean

# 2. 强制更新所有依赖
mvn dependency:sources

# 3. 或者使用离线模式先下载
mvn dependency:go-offline

# 4. 重新编译
mvn compile -U

# 5. 重新生成Wrapper文件,指定maven版本
mvnw wrapper:wrapper -Dmaven=3.9.12
# 或
mvn wrapper:wrapper -Dmaven=3.9.12

# 6.清理idea的缓存
mvnw.cmd -U clean

# 7. 查看项目使用的mvn和jdk版本,在项目根目录执行
./mvnw -v  # Windows: mvnw.cmd -v

如果还是不行,可以删除项目下的idea文件,重新打开,然后编译compile 和 install试一下

相关推荐
吃我一窝jio10 小时前
Python与Go线程模型深度对比
java·开发语言·python
这个昵称不容易10 小时前
SpringBoot 购物推荐网站的设计与实现:120 个 Java 文件、147 个接口、13 张表,附真实运行截图
java·springboot·毕设
文丑颜不良啊10 小时前
LeetCode3041~3060题目解析
java·leetcode
文丑颜不良啊11 小时前
LeetCode3101~3120题目解析
java·leetcode
Resean022312 小时前
SpringMVC 6+源码分析(十一)视图渲染与异步请求(收尾篇)
java·spring·springmvc
靠沿12 小时前
MySQL数据库进阶——存储过程和触发器
java·数据库·mysql
码少女13 小时前
MySQL--库与表的增删改查基础
java·数据库·mysql
Flynt15 小时前
掘金热文说 Spring Boot 4.1 默认开虚拟线程,我实测后发现了更狠的坑
java·spring boot·性能优化
Resean022316 小时前
Spring 源码分析(一)IOC 容器总览与 refresh() 全景
java·后端·spring
保利威视频SaaS小张16 小时前
企业直播接入笔记 12|企业内训直播怎么做签到和学时统计,防挂机这件事比想象中难
java·前端·数据库·笔记·视频云·polvy·polyv