Maven找不到依赖项[dependencyResolutionException] [英] Maven can't find dependencies [dependencyResolutionException]

查看:197
本文介绍了Maven找不到依赖项[dependencyResolutionException]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中添加了Maven依赖项,并且我的项目在本地编译,而不在服务器上编译.它无法解决新添加的依赖项.

I added a Maven dependency to my project and my project compiles locally, while it doesn't compile on server. It can not resolve the newly added dependency.

这是我的pom.xml文件:

This is my pom.xml file:

    <repositories>
        <repository>
            <id>rep</id>
            <name>Repository</name>
            <url>http://artifacts.com/rep</url>
            <releases>
               <enabled>true</enabled>
               <updatePolicy>always</updatePolicy>
            </releases>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.project.rest</groupId>
            <artifactId>common</artifactId>
            <version>2.0.5</version>
        </dependency>
    </dependencies>

这是我的控制台输出错误:

And this my console output with an error:

 Downloading: http://artifacts.com/rep/com/project/rest/common/2.0.5/common-2.0.5.pom
    [WARNING] The POM for com.project.rest:common:jar:2.0.5 is missing, no dependency information available

    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 6.154s
    [INFO] Finished at: Tue Feb 03 06:58:35 BRT 2015
    [INFO] Final Memory: 9M/152M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal on project server: Could not resolve dependencies for project org.server:
    server:jar:2.5.1-SNAPSHOT: The following artifacts could not be resolved: com.project.rest:common:jar:2.0.5:
    Could not find artifact com.project.rest:common:jar:2.0.5 in rep (http://artifacts.com/rep) -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [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 read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

(我隐藏了所有真实的URL和程序包.)

可能是什么问题?

推荐答案

第一行正在下载:..."仅表示maven尝试下载工件.这不是关于成功的声明.如果maven成功,您将获得另一行以"Downloaded:..."开头

The first line "Downloading:..." only says that maven tries to download the artifact. It is no statement about success. If maven is successful you will get another line starting with "Downloaded: ..."

因此,在您的情况下,maven无法下载文件.在浏览器中检查记录的URL是否存在以及是否受保护.

So in your case maven was not able to download the file. Check the logged url in your browser if it does exist and if it is protected.

BTW <updatePolicy>always</updatePolicy>对于发行版回购相当少见,因为发行版不应再更改.

BTW <updatePolicy>always</updatePolicy> is quite uncommon for release repos, because releases should not change any more.

这篇关于Maven找不到依赖项[dependencyResolutionException]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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