Maven没有在Eclipse中下载依赖关系 [英] Maven not downloading dependencies in Eclipse

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

问题描述

我正在eclipse中建立一个项目。这个项目通过命令行(全部 mvn 命令,如 mvn package mvn compile mvn clean install )工作完全正常。在STS或Eclipse上设置此项目。我看到一些依赖项没有下载,即使它们存在于 pom.xml 中。然而,在maven存储库中搜索它们并将jar下载到本地计算机,然后将其添加到构建路径使其在Eclipse上工作。



有没有什么我们需要做的eclipse,以确保它从存储库中下载所有的依赖项。



我的POM

 <依赖关系> 
< groupId> org.apache.bookkeeper< / groupId>
< artifactId> bookkeeper-server-compat410< / artifactId>
< version> 4.1.0< / version>
< scope> test< / scope>
<排除>
< exclude>
< groupId> org.apache.bookkeeper< / groupId>
< artifactId> bookkeeper-server< / artifactId>
< / exclusion>
< / exclusions>
< / dependency>
<依赖关系>
< groupId> org.apache.bookkeeper< / groupId>
< artifactId> bookkeeper-server-compat420< / artifactId>
< version> 4.2.0< / version>
< scope> test< / scope>
<排除>
< exclude>
< groupId> org.apache.bookkeeper< / groupId>
< artifactId> bookkeeper-server< / artifactId>
< / exclusion>
< / exclusions>
< / dependency>

这两个工件都没有为eclipse下载,并且有jar发现



但是手动将其添加到构建路径中创建了一个新文件夹(参考库),并解决了Eclipse错误。为什么Eclipse不会自己从maven仓库下载和导入这些依赖项?是Eclipse中的错误还是我身边的一些问题。请帮助。



解决方案


解决方案1:


设置正确的代理:

 < proxy> 
< id>可选< / id>
< active> false< / active>
< protocol> http< / protocol>
< username>< / username>
< password>< / password>
< host> 172.27.171.91< / host>
< port> 8080< / port>
< / proxy>




Solution2:


只需删除

 从文件夹
更新的扩展文件

并尝试更新maven。



[大部分时间解决方案将工作]


I am setting up a project in eclipse . This projects builds successfully through command line(all mvn commands like mvn package, mvn compile, mvn clean install) work perfectly fine. While setting up this project on STS or Eclipse . I see some of the dependencies are not getting downloaded even though they are present in pom.xml. However, searching them in the maven repository and downloading the jar to my local computer and then adding them to build path makes it work on Eclipse.

Is there anything that we need to do to eclipse to make sure it downloads all the dependencies from the repository.

My POM:

<dependency>
    <groupId>org.apache.bookkeeper</groupId>
    <artifactId>bookkeeper-server-compat410</artifactId>
    <version>4.1.0</version>
    <scope>test</scope>
    <exclusions>
        <exclusion>
            <groupId>org.apache.bookkeeper</groupId>
            <artifactId>bookkeeper-server</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.apache.bookkeeper</groupId>
    <artifactId>bookkeeper-server-compat420</artifactId>
    <version>4.2.0</version>
    <scope>test</scope>
    <exclusions>
        <exclusion>
            <groupId>org.apache.bookkeeper</groupId>
            <artifactId>bookkeeper-server</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Both these artifacts were not downloaded for eclipse and there jars found http://mvnrepository.com/artifact/org.apache.bookkeeper/bookkeeper-server-compat410/4.1.0 and http://mvnrepository.com/artifact/org.apache.bookkeeper/bookkeeper-server-compat420/4.2.0 were not present in the folder for MavenDependencies and were subsequently giving errors in Eclipse.

However manually adding them to the build path created a new folder (Reference Library) and resolved the Eclipse Errors . Why did Eclipse not download and import these dependencies by themselves from the maven repository ?? Is it a bug in Eclipse or some problem from my side . Please help.

解决方案

Solution 1:

Set correct proxy:

<proxy>
    <id>optional</id>
    <active>false</active>
    <protocol>http</protocol>
    <username></username>
    <password></password>
    <host>172.27.171.91</host>
    <port>8080</port>
</proxy>

Solution2 :

just delete

lastupdated extension files from folder

and try updating maven.

[Most of the times this solution will work]

这篇关于Maven没有在Eclipse中下载依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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