2021-6-24记一次spring-boot-starter-parent无法下载依赖包的问题

三个点定位问题:

1、查看maven的setting.xml里配置是否正确,为了方便,直接将我的粘贴进去就好了(不过需要你将自己的setting做一个备份)

<!-- 本地仓库的位置 -->
<localRepository>D:\install\repository</localRepository>

<!-- Apache Maven 配置 -->
<pluginGroups/>
<proxies/>

<!-- 私服发布的用户名密码 -->
<!-- servers>
    <server>
        <id>releases</id>
        <username>账号</username>
        <password>密码</password>
    </server>
    <server>
        <id>snapshots</id>
        <username>账号</username>
        <password>密码</password>
    </server>
</servers -->


<mirrors>
  	<!-- 官方镜像 -->
	<!--mirror>
	   <id>google-maven-central</id>
	   <name>Google Maven Central</name>
	   <url>https://maven-central.storage.googleapis.com/repos/central/data/</url>
	   <mirrorOf>central</mirrorOf>
	</mirror --> 
	
	<!-- mirror>
	  <id>mirrorId</id>
	  <mirrorOf>central</mirrorOf>
	  <name>146</name>
	  <url>http://central.maven.org/maven2/</url>
	</mirror -->
	<!-- 阿里云镜像 -->
    <mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <!-- https://maven.aliyun.com/repository/public/ -->
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
	<mirror>
		<id>planetmirror.com</id>
		<name>PlanetMirror Australia</name>
		<url>http://downloads.planetmirror.com/pub/maven2</url>
		<mirrorOf>central</mirrorOf>
	</mirror>
</mirrors>

<!-- 配置: java8, 先从阿里云下载, 没有再去私服下载  -->
<!-- 20190929 hepengju 测试结果: 影响下载顺序的是profiles标签的配置顺序(后面配置的ali仓库先下载), 而不是activeProfiles的顺序 -->
<profiles>
    <!-- 全局JDK1.8配置 -->
    <!-- profile>
        <id>jdk1.8</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>1.8</jdk>
        </activation>
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
            <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
        </properties>
    </profile -->


    <!-- Nexus私服配置: 第三方jar包下载, 比如oracle的jdbc驱动等 -->
    <!-- profile>
        <id>dev</id>
        <repositories>
            <repository>
                <id>nexus</id>
                <url>http://nexus.xxxx.cn:8081/repository/maven-public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>maven-public</id>
                <name>Public Repositories</name>
                <url>http://nexus.xxxx.cn:8081/repository/maven-public/</url>
            </pluginRepository>
        </pluginRepositories>
    </profile -->

    <!-- 阿里云配置: 提高国内的jar包下载速度 -->
    <!-- profile>
        <id>ali</id>
        <repositories>
            <repository>
                <id>alimaven</id>
                <name>aliyun maven</name>
                <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>alimaven</id>
                <name>aliyun maven</name>
                <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            </pluginRepository>
        </pluginRepositories>
    </profile -->

</profiles>

<!-- 激活配置 -->
<!-- activeProfiles>
    <activeProfile>jdk1.8</activeProfile>
    <activeProfile>dev</activeProfile>
    <activeProfile>ali</activeProfile>
</activeProfiles -->

然后将localRepository替换为你的本地仓库。删除本地库中对应的包:在这里插入图片描述
完成后重新加载项目。

2、有时候因为网络原因,从阿里云下载不下来jar包也比较常见,将阿里云的镜像注释掉,使用官方的镜像再试试。

3、如果换了好几个远程仓库还不行,看看你的pom文件中是不是这样的:
在这里插入图片描述
如果是,恭喜你和我一样脑子瓦特了,改成这样就好了:
在这里插入图片描述

4、那就需要考虑你的公司是否还有人是这个问题,是否是因为公司防火墙拦截导致的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值