Maven 安装错误:无法解决依赖关系 [英] Maven install error: Dependency could not be resolved

查看:34
本文介绍了Maven 安装错误:无法解决依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Maven 3.1.1.当我运行 mvn install 时,出现以下错误:

I am using Maven 3.1.1. When I run mvn install I get the following error:

D:spring source>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringDependencies 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
dependency-plugin/2.8/maven-dependency-plugin-2.8.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.648s
[INFO] Finished at: Mon Dec 16 15:01:47 IST 2013
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of it
s dependencies could not be resolved: Failed to read artifact descriptor for org
.apache.maven.plugins:maven-dependency-plugin:jar:2.8: Could not transfer artifa
ct org.apache.maven.plugins:maven-dependency-plugin:pom:2.8 from/to central (htt
p://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.mave
n.apache.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException

我的 pom.xml 是:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>spring-source-download</groupId>
  <artifactId>SpringDependencies</artifactId>
  <version>1.0</version>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
            <version>3.1.1</version>
            <executions>
              <execution>
                <id>download-dependencies</id>
                  <phase>generate-resources</phase>
                    <goals>
                      <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                      <outputDirectory> ${project.build.directory}/dependencies </outputDirectory>
                    </configuration>
              </execution>
            </executions>
      </plugin>
    </plugins>
  </build>
</project>

推荐答案

无法转移神器org.apache.maven.plugins:maven-dependency-plugin:pom:2.8 from/to中央(http://repo.maven.apache.org/maven2):repo.maven.apache.org:未知主机 repo.maven.apache.org

Could not transfer artifact org.apache.maven.plugins:maven-dependency-plugin:pom:2.8 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org

您的 Maven 似乎无法访问远程中央存储库.

It seems like your maven cannot access remote central repository.

  • 检查您是否已建立互联网连接.
  • 检查您是否可以访问默认的 maven repo http://repo.maven.apache.org/maven2 在浏览器中.
  • 检查您的 中的配置是否正确,settings.xml
  • Check if you have an established internet connection.
  • Check if you can access default maven repo http://repo.maven.apache.org/maven2 in your browser.
  • Check if you have correct configuration in <repositories> and <proxies> in your your settings.xml

这篇关于Maven 安装错误:无法解决依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆