Maven not downloading dependencies in Eclipse

后端 未结 11 1450
伪装坚强ぢ
伪装坚强ぢ 2021-01-03 19:08

I am setting up a project in eclipse . This projects builds successfully through command line(all mvn commands like mvn package, mvn compile<

相关标签:
11条回答
  • 2021-01-03 19:33

    The following worked for me.
    Just right-click on Project -> Maven -> Update Project... such as it is shown here.

    0 讨论(0)
  • 2021-01-03 19:35

    Make sure you're defining the dependency as close as possible to the leaf of the project tree where it is needed. Otherwise, Maven might ignore it.

    For example, if you have a parent project that references projects A and B and the dependency is with respect to project A, then defining the dependency in the parent's pom.xml might get ignored by Maven. So, define it in project A's pom.xml.

    Parent Project's pom.xml
       Sub-project A's pom.xml <<< define the dependency where it is needed
       Sub-project B's pom.xml
    
    0 讨论(0)
  • 2021-01-03 19:38

    Sometimes there is an error downloading a dependency - eg. some files are downloaded but the actual JAR is missing from the local Maven repository.

    In this case I had to delete the whole folder of the problematic dependency in the local maven repository. Only then did Maven update work (Right-click on the project and select Project > Maven > Update Project.... )

    0 讨论(0)
  • 2021-01-03 19:38

    In my case, I had unchecked Build automatically. Checking it again started downloading the jars.

    0 讨论(0)
  • 2021-01-03 19:45

    I had faced a similar issue and following the below steps helped me fix it.

    1. Delete the last modified jar from respective folders.
    2. Select the project

      • Right Click -> Maven

      • Update project..

    It will download all the missing Jars.

    0 讨论(0)
  • 2021-01-03 19:47

    I was facing similar sort of issue. I tried deleting folders inside .m2 and again building maven project.
    I could download all dependency except one dependency which we have created by ourselves and published on Nexus.
    Then I changed by java pointing from JRE to JDK which solved my problem

    0 讨论(0)
提交回复
热议问题