" (which I called "eclipse repo"), because these jars weren't in the central maven repository. So, maven downloads the jars, installed them in the local repository, and everything works fine.

Then, I changed the junit version from 3.8.x to 4.8.x to run some tests, and here is when the fun begins; when I changed the junit version to 4.8.x, then maven went to download it from the remote repository, BUT it alway tries to download the new junit version from the eclipse repo, and the junit jar is in the maven central repository!.

After this, I removed the eclipse repository from the project pom.xml, and maven proceeds to locate and download the new junit version, AND ALSO it tries to download ¡again! the eclipse jars (javax.persistence and eclipselink), but now from the maven central repository, which produces a beautifull error, because these files aren't there. Now, my questions are:

1.- why maven is trying to download the eclipselink files again, if they are in my local repository (I'm sure about this)?. Mmmmm, better yet, when I write down again the eclipse repo in the project pom.xml, then maven stops trying download the eclipselink files. It looks like, the eclipselink jars are LINKED to the remote repository where they were downloaded from, and when I remove the eclipse repo then maven feels something like, hey! these eclipselink jars were not downloaded from the maven central repository, and I don't see the repository where they were downloaded from, let's download them again - it's so funny download some shit I already have!!!! -- WTF is this!!!

2.- why maven doesn't search in the remote repositories availables?, if an artifact is not in one repository, it probably could be in the next one.

3.- where is written the maven central repo, which file?, it's not in the settings.xml, it's hidden somewhere else. I'm trying to add more remote repos to maven, but I can't find where is the maven central repo. I'm using maven 3.

BTW, I know I can install the junit jar manually, but it's not the point. Maven should search in the available repositories the artifacts it needs, and ALSO use the artifacts already installed in your local repo.

If someone could please help me with this, I'll really appreciate it. Thanks in advance.

As you can see, there is the eclipse repo, if I remove this eclipse repo from the pom.xml then maven starts downloading the eclipselink jars, that are already instlalled in local repository.

Regarding the /.m2/settings.xml, I have no such file, the only settings.xml file I found is in $M2_HOME/conf/settings.xml, and believe me there is no trace of the maven central repository nor any other repository. See it yourself:

so you say that your local repo contains all the eclipse link files in the right groups? Also: you may want to add: releases enabled as right now, i think your pom will trigger maven to look for snapshots each time you run a build.
–
mkroMay 24 '11 at 21:20

I have many poms that add a repo and don't lose central. YOu could try copying the definition of the central repo from the global settings and see if that helps. You could run mvn -X. You could ask on the maven users list, which has a higher concentration of expertise.