Maven tries to download the correct artifact version, but from the false repository -----------------------------------------------------------------------------------
Key: MNG-4076 URL: http://jira.codehaus.org/browse/MNG-4076 Project: Maven 2 Issue Type: Bug Components: Artifacts and Repositories Affects Versions: 2.0.10 Reporter: Clovis Seragiotto My project depends on the artifact org.eclipse.core.runtime 3.4.0, which depends on org.eclipse.osgi [3.2.0,4.0.0). Our company's repository has both org.eclipse.core.runtime 3.4.0 and org.eclipse.osgi.3.4.2, while the Maven central repository has older versions of both artifacts. When compiling our project, maven tries to download org.eclipse.osgi.3.4.2 from the central repository but not from the company's repository: ... [INFO] Using default encoding to copy filtered resources. Downloading: http://repo1.maven.org/maven2/org/eclipse/osgi/3.4.2/osgi-3.4.2.jar [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) org.eclipse:osgi:jar:3.4.2 ... Path to dependency: 1) main:main:jar:0 2) org.eclipse.core:runtime:jar:3.4.0 3) org.eclipse:osgi:jar:3.4.2 ... from the specified remote repositories: OurRepository (file:///O|/maven-repository) central (http://repo1.maven.org/maven2) This is how the project's pom looks like: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>main</groupId> <artifactId>main</artifactId> <version>0</version> <dependencies> <dependency> <groupId>org.eclipse.core</groupId> <artifactId>runtime</artifactId> <version>3.4.0</version> </dependency> </dependencies> <repositories> <repository> <id>OurRepository</id> <name>our repository</name> <url>file:///O|/maven-repository</url> <releases> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> <checksumPolicy>fail</checksumPolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> </project> If I add the central repository to the pom BEFORE our repository, then org.eclipse.osgi is found in our repository. If, however, I add the central repository to the pom AFTER our repository, org.eclipse.osgi is again not found. Simplified version for the poms of org.eclipse.* (so that one can deploy fake versions of org.eclipse.osgi and org.eclipse.core.runtime): <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.eclipse</groupId> <artifactId>osgi</artifactId> <version>3.4.2</version> <distributionManagement> <repository> <id>OurRepository</id> <name>our repository</name> <url>file:///O|/maven-repository</url> </repository> </distributionManagement> </project> <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.eclipse.core</groupId> <artifactId>runtime</artifactId> <version>3.4.0</version> <dependencies> <dependency> <groupId>org.eclipse</groupId> <artifactId>osgi</artifactId> <version>[3.2.0,4.0.0)</version> </dependency> </dependencies> <distributionManagement> <repository> <id>OurRepository</id> <name>our repository</name> <url>file:///O:|/maven-repository</url> </repository> </distributionManagement> </project> -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira