这两天刚刚接触springboot,跟着一位博主敲框架,结果他的一点问题没有,而我的却报错。第一反应肯定不是代码的问题,那就是环境配置的问题。果然,发现了问题如图

在我寻找大量的资料后找到了一个完全解决了我问题的方法。

        就是在maven的conf目录下的setting.xml 文件中加上这样一段配置:

<!-- 阿里云仓库 -->
        <mirror>
            <id>alimaven</id>
           <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>https://maven.aliyun.com/nexus/content/repositories/central/</url>
         </mirror>
     
        <!-- 中央仓库1 -->
        <mirror>
            <id>repo1</id>
             <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://repo1.maven.org/maven2/</url>
         </mirror>
     
         <!-- 中央仓库2 -->
         <mirror>
             <id>repo2</id>
             <mirrorOf>central</mirrorOf>
             <name>Human Readable Name for this Mirror.</name>
             <url>http://repo2.maven.org/maven2/</url>
         </mirror>

如果你跟我一样加了之后错误还是没有解决,那么就在pom.xml文件中加上:

<repositories>
    <repository>
        <id>central</id>
        <url>http://host:port/content/groups/public</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <url>http://host:port/content/groups/public</url>
    </pluginRepository>
</pluginRepositories>

就这样,我的问题解决了!

奥,参考文献是:(9条消息) 配置了maven的国内镜像后,问题:(https://repo.maven.apache.org/maven2): Not authorized , ReasonPhrase:Authorizatio_心灵*寄语&的博客-CSDN博客_https://repo.maven.apache.org

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐