关于#java#的问题:mave配置错误(开发工具-intellij-idea)

maven配置镜像更新后出现错误
org.apache.maven.plugins:maven-surefire-plugin:2.12.4
org.apache.maven.plugins:maven-resources-plugin:2.6
org.apache.maven.plugins:maven-jar-plugin:2.4
org.apache.maven.plugins:maven-compiler-plugin:3.1

img

这个一般都是下载插件出现问题了,建议使用阿里云的镜像源
找到Maven的settings.xml文件,该文件通常位于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>
</mirrors>

然后重新更新一下

maven reimport 看看有没什么错误

保证Idea maven配置走的是自定义的maven配置后,pom.xml右键 -> Maven -> Reload Project

  • 给你找了一篇非常好的博客,你可以看看是否有帮助,链接:IntelliJ Idea14 创建Maven多模块项目
  • 除此之外, 这篇博客: IDEA 教程(基础篇)第04话:IntelliJ IDEA 中高效地使用 Maven(图文并茂)中的 3.2 添加国内镜像源 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • <mirrors> 标签下添加 <mirror>,配置一个国内镜像源,用于加速 jar 包的下载。下面示例代码为阿里云的镜像源。

    <!-- 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>central</mirrorOf>
      <name>Nexus aliyun</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>