Eclipse - Maven - Dependencies not getting automatically reflected

15,395

Solution 1

Finally issue got resolved :) :)

Here what was done:

  • Followed @khmarbaise, @SaifAsif, @Adrian comments :) Thanks for them I was able to understand the overlooked configurations
  • Installed Eclipse Kepler (I was using Eclipse Juno) and Spring IDE from marketplace
  • Maven Download setting as shown by @khmarbaise
  • Copied global setting of maven (f:\maven\conf\settings.xml) to my local setting (C:\Documents and Settings\Sandy.m2). I didn't modified any thing in it.
  • Windows - System environment variables were set
  • M2_HOME - To the local installion (f:\Maven)
  • M2 - %M2_HOME%\bin
  • JAVA_HOME (already exist) - f:\java
  • PATH - %M2%;%JAVA_HOME%\bin
  • CLASSPATH - %JAVA_HOME%

At end I was able to see the dependencies automatically.

Thanks!

Solution 2

Also if I check Maven Repositories (select by Windows - Show Views - Others - Maven - Maven Repositories), nothing is shown in Global Repositories - central(http://repo.maven.apache.org/maven2).

It is most likely that your central Repository index might never have been updated. To resolve it , Go to Window > Show View > Other > type Maven in filter and select Maven Repositories. In Maven Repositories tab Expand Global Repositories, Right-click on central and Update Index.

The process will initially take about a few minutes depending on the network speed but once its done, the search box will start showing results when-ever you type in the name of any jar

Solution 3

The configuration for Eclipse can be found here:

enter image description here

The screen shot is from Mac OS but also on Windows you will find this under preferences -> Maven.

Share:
15,395
Sandeep
Author by

Sandeep

Updated on June 07, 2022

Comments

  • Sandeep
    Sandeep almost 2 years

    I have installed

    • Java 1.7
    • Eclipse Juno
    • From Eclipse Market place have installed - Maven Integration for Eclipse WTP (a.k.a m2e-wtp), m2e-apt, Spring IDE, The Spring Tool Suite™ (STS)
    • Have defined M2_HOME as directory where Maven is installed. PATH updated as %M2_HOME%/bin

    I am working on Windows XP.

    I am able to create a Maven project but when trying to add Dependencies (select pom.xml - Dependencies - Add) artifactId's "Enter groupId, artifactId or sha1 prefix or pattern" which are inputted are not getting displayed. Say if I input "springframework", it only reflect the jars that installed locally and don't search over the internet. Also if I check Maven Repositories (select by Windows - Show Views - Others - Maven - Maven Repositories), nothing is shown in Global Repositories - central (http://repo.maven.apache.org/maven2).

    In case, if I manually put required artifactID in pom.xmland then update maven it downloads the required jars.

    I am working on my home computer where I don't have any proxies and has set following in local m2 settings (C:\Documents and Settings\Sandy\.m2\Settings.xml)

    Can you please advise, what setting I need to do so that inputted artifact's can be added using add Dependencies option?

    Thanks in advance

  • Adrian
    Adrian over 10 years
    Please note, that this process could take more than just a "few" minutes ;)
  • Saif Asif
    Saif Asif over 10 years
    sometimes, yes ! I remember my initial update/re-index took about 7-10mins. Actually the size of the file ( the index file ) is approximately around 60MB ( if I remember correctly ).
  • Adrian
    Adrian over 10 years
    Ui, that's quite small. My indexed file is typically larger than 1GB. Maybe we should cleanup our internal Nexus ;)
  • Saif Asif
    Saif Asif over 10 years
    your talking about the nexus indexer ? I thought you meant the index file of mvn central. Thats 60MB. Oh and yeah the nexus index files usually count up in GB . You also don't cleanup your nexus? Join the club ;)
  • Sandeep
    Sandeep over 10 years
    @SaifAsif - Any message on bar is shown? I Updated the Index and even after 10-15 mins nothing happened!!
  • Sandeep
    Sandeep over 10 years
    @SaifAsif - Tried couple of times, but is not working. I even uninstalled all Maven and Spring IDE from Maketplace and re-installed it but it didn't helped! Any advise>
  • Saif Asif
    Saif Asif over 10 years
    @Sandeep Yes it should show a status bar showing something like downloading/updating maven index. And it should take a couple of minutes.
  • Saif Asif
    Saif Asif over 10 years
    Thats great. Don't forget to upvote and accept the answer :)
  • pannu
    pannu almost 7 years
    Have fallowed all the steps but still nothing is showing up as I type.