Idea中maven依赖爆红解决方案(附上settings.xml文本)

这篇具有很好参考价值的文章主要介绍了Idea中maven依赖爆红解决方案(附上settings.xml文本)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

前言:

        最近要以若依-前后端分离(RuoYi-Vue)项目为框架进行研发。
        以SVN做版本控制,我先从小乌龟(TortoiseSVN)的版本仓库中将项目检出(checkout),检出的项目包含.svn文件用以SVN版本追踪。所以项目相关的依赖文件是事先部署完毕的,这样我就不能无厘头地为了适配本地环境而进行修改。

问题描述:

        idea依赖爆红,Java技术,intellij-idea,java,maven,xml,ruoyi项目依赖爆红  嘎嘎红...不要慌。

第一步:
        先看看IDE工具的maven配置是否正确。
        idea依赖爆红,Java技术,intellij-idea,java,maven,xml,ruoyi
         貌似没什么问题。


第二步:
        看看项目SDK版本是否正确。
        idea依赖爆红,Java技术,intellij-idea,java,maven,xml,ruoyi                
        貌似也没什么问题。
        (其实上面我也是一点点改过来的,我甚至重新部署了一遍jdk1.8/(ㄒoㄒ)/~~)

        到这里我只剩下<project>和<parent>标签在报红
        别慌,马上第三步...

第三步:
        咱们看看都报什么错。
        idea依赖爆红,Java技术,intellij-idea,java,maven,xml,ruoyi
        可找到你了,这是maven的配置文件settings.xml语法出错了。

解决:

        好办,随随便便网上复制一份settings.xml文本,然后把本地仓库改成自己的就完活了。
                idea依赖爆红,Java技术,intellij-idea,java,maven,xml,ruoyi
        注意仓库路径要用‘\’号。
        
        然后再配置一下国内镜像,给依赖下载提提速。
        idea依赖爆红,Java技术,intellij-idea,java,maven,xml,ruoyi

<mirror>
			<id>nexus-aliyun</id>
			<mirrorOf>*</mirrorOf>
			<name>Nexus aliyun</name>
			<url>http://maven.aliyun.com/nexus/content/groups/public</url>
	</mirror>
  </mirrors>

我下面把settings.xml文件贴上来,只要改一下本地maven仓库就能使用。

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
    <!-- 下面的路径改成你本地的-->
     <localRepository>D:\Mavenrepository</localRepository>
  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->

  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->

  <!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
  </pluginGroups>

  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>

  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
  <servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>

  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
    <mirror>
			<id>nexus-aliyun</id>
			<mirrorOf>*</mirrorOf>
			<name>Nexus aliyun</name>
			<url>http://maven.aliyun.com/nexus/content/groups/public</url>
	</mirror>
  </mirrors>

  <!-- profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are intended to provide local machine-
   | specific paths and repository locations which allow the build to work in the local environment.
   |
   | For example, if you have an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that the variable is
   | dereferenced during the build process to configure the cactus plugin.
   |
   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
   | section of this document (settings.xml) - will be discussed later. Another way essentially
   | relies on the detection of a system property, either matching a particular value for the property,
   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
   |       repositories, plugin repositories, and free-form properties to be used as configuration
   |       variables for plugins in the POM.
   |
   |-->
  <profiles>
    <!-- profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id's for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile>
      <id>jdk-1.4</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    -->

    <!--
     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
     | might hypothetically look like:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
    <profile>
      <id>env-dev</id>

      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>

      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>
    -->
  </profiles>

  <!-- activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
  -->
</settings>

 参考:
        Maven安装和配置阿里云镜像(解决在idea中Maven加载依赖慢的问题,保姆级教学)_maven配置阿里云镜像_热爱编程的申同学的博客-CSDN博客

创建Maven项目,提示'settings.xml' has syntax errors - 简书文章来源地址https://www.toymoban.com/news/detail-755533.html

到了这里,关于Idea中maven依赖爆红解决方案(附上settings.xml文本)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Idea卡在Resolving Maven dependencies的解决方案

    在Reimpot All Maven Porjects时, 如果项目过大, maven依赖过多, 会直接卡在Resolving Maven dependencies这步 确认仓库已换源为阿里云仓库,仍然很慢,可以尝试在settings里调参 -Xms:初始堆大小 -Xmx:最大堆大小 经实测,在物理内存够用的情况下,可以提高至 -Xms2048m -Xmx4096m。 推测出现该情况

    2024年02月06日
    浏览(36)
  • idea中maven项目模块变成灰色原因及解决方案

    1、idea中maven项目模块变成灰色 2、原因 可能是忽略了maven模块,可以尝试如下解决方法:在idea中设置setting-》搜索maven-》点击ignored files,看右边的面板中变灰的maven模块是否被勾选pom.xml 3、解决方案 去掉勾选的选项

    2024年02月16日
    浏览(52)
  • IDEA 每次新建工程都要重新配置 Maven 解决方案

    IDEA 每次新建工程都要重新配置 Maven,是一件相当浪费时间的事情。这是 因为在创建一个项目后,在 File - Settings - Build,Execution,Deployment - Build Tools - Maven 下配置了 Maven home path 、 User settings file 和 Local repository ,只对当前项目有效,再打开新项目还是默认的配置 。 而这个问题

    2024年02月04日
    浏览(81)
  • 【错误记录】Android 编译报错 ( Could not resolve xxx | 手动下载依赖库并进行本地配置 Gradle 依赖的解决方案 | 构建 Maven 依赖下载路径 )

    编译 Android Studio 项目时 , 报如下错误 , 下载依赖库失败 ; 报错信息 : 下面是 当前 Android 项目的 Gradle 配置中的 Maven 仓库 ; 其中使用 maven { url \\\"https://repo.spring.io/plugins-release/\\\" } 配置的 Maven 仓库就是对应的地址 ; 使用 google() 函数配置的 Maven 仓库地址 是 https://maven.google.com/ , 可

    2024年04月15日
    浏览(51)
  • 已解决 IDEA Maven 项目中 “Could not find artifact“ 问题的常见情况和解决方案

    🌷🍁 博主 libin9iOak带您 Go to New World.✨🍁 🦄 个人主页——libin9iOak的博客🎐 🐳 《面试题大全》 文章图文并茂🦕生动形象🦖简单易学!欢迎大家来踩踩~🌺 🌊 《IDEA开发秘籍》学会IDEA常用操作,工作效率翻倍~💐 🪁🍁 希望本文能够给您带来一定的帮助🌸文章粗浅,敬

    2024年02月11日
    浏览(43)
  • 【IDEA大项目依赖分析卡死-解决方案】Processing build files for dependencies analysis...

    最近一直在研究一个大型项目,在IDEA里面启动调试的时候,IDEA经常会进行Processing build files for dependencies analysis…(处理构建文件进行依赖分析),并且在这个步骤耗时太久甚至直接卡死。经过一些排查找到了解决方案。 IDEA经常会进行Processing build files for dependencies analysis…(

    2024年02月14日
    浏览(39)
  • Maven本地存在jar包IDEA依旧爆红,一招解决该问题

    有时内网或无网络的环境中开发程序,需要添加依赖,通常只能拷贝仓库到内网,但是拷贝的容易出现爆红,无法正常使用,以下是处理方法: 灵感来源:https://www.jianshu.com/p/355084973658 看到上面的文章,才意识到,直接拷贝是不行的,两仓库源头不一致。maven会进行比对,因

    2023年04月18日
    浏览(71)
  • IDEA中Maven报错:Failed to read artifact descriptor for解决方案

    导入spark-core依赖报错 Failed to read artifact descriptor for com.esotericsoftware:kryo-shaded:jar: 图片忘记报错了,拿一张网友的图,现象是spark-core成功导入,但是pom文件中project处报错 这个原因是因为maven版本不匹配,咱也不知道为啥不匹配,改日再研究,今天着急下班 解决方法: 1、 打开

    2024年02月05日
    浏览(44)
  • IDEA Maven 项目中 “Could not find artifact“ 问题的常见情况和解决方案

    在IDEA(IntelliJ IDEA)中使用Maven构建项目时,有时会遇到“Could not find artifact”这样的错误。这个错误通常意味着Maven试图下载或查找某个依赖项,但是没有在配置的仓库中找到。这个问题可能会导致项目构建失败,因此需要了解常见的情况以及相应的解决方案。 IDEA Maven项目中

    2024年04月26日
    浏览(64)
  • Maven导入依赖时爆红/导入依赖了却没用

    大量依赖爆红 把存放依赖的文件删除了重新导一下 找到依赖包存放位置 把local repository路径下内容全部删除,重新导入maven pom.xml中 爆红 缺少依赖,添加依赖即可 在命令行输 运行后出现Spring图案 决:C:UsersAdministrator.m2repositoryorgapachetomcatembed 将该目录下的所有文件删除,

    2024年02月07日
    浏览(37)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包