Failure to resolve artifact if there is a dependency that uses version range
----------------------------------------------------------------------------

                 Key: MNG-4380
                 URL: http://jira.codehaus.org/browse/MNG-4380
             Project: Maven 2
          Issue Type: Bug
          Components: Dependencies
    Affects Versions: 2.x
         Environment: Unix, JDK 1.6
            Reporter: Jane Young
         Attachments: pom.xml

I have a  simple pom.xml that defines a dependency on jsp-impl from the Maven 
repository:  http://download.java.net/maven/2

--------------------------pom.xml-----------------------------
<?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>maven.test</groupId>
<artifactId>simple</artifactId>
<version>1.0</version>
<name>SimpleTest</name>
<repositories>
    <repository>
        <id>java.net</id>
        <name>Java Net Maven 2 </name>
        <url>http://download.java.net/maven/2</url>
    </repository>
</repositories>
<dependencies>
 <dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>jsp-impl</artifactId>
    <version>2.1.3-b17</version>
  </dependency>
</dependencies>
</project>

-------------------------------------------------------------------

Running "mvn install" will fail with the message:

Downloading: 
http://repo1.maven.org/maven2/javax/servlet/jsp/jsp-api/2.1.3-b05/jsp-api-2.1.3-b05.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) javax.servlet.jsp:jsp-api:jar:2.1.3-b05

Try downloading the file manually from the project website.

Then, install it using the command:
  mvn install:install-file -DgroupId=javax.servlet.jsp -DartifactId=jsp-api 
-Dversion=2.1.3-b05 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
  mvn deploy:deploy-file -DgroupId=javax.servlet.jsp -DartifactId=jsp-api 
-Dversion=2.1.3-b05 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] 
-DrepositoryId=[id]

Path to dependency:
    1) maven.test:simple:jar:1.0
    2) org.glassfish.web:jsp-impl:jar:2.1.3-b17
    3) javax.servlet.jsp:jsp-api:jar:2.1.3-b05

----------
1 required artifact is missing.

for artifact:
maven.test:simple:jar:1.0

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
java.net (http://download.java.net/maven/2)


It's complaining about resolving the artifact jsp-api.  But this artifact 
(javax.servlet.jsp:jsp-api:jar:2.1.3-b05) exists in java.net 
(http://download.java.net/maven/2/javax/servlet/jsp/jsp-api/2.1.3-b05/).   
Looks like it's trying to download the artifact from the Central repo 
(http://repo1.maven.org/maven2) and not  even search for it in java.net.    The 
message at the end is not true.

If I explicitly define jsp-api artifact in the pom.xml then it compiles 
successfully. 

Note:  The dependency of jsp-api uses version range.  
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>[2.1.3-b02,2.2)</version>
        </dependency>

It maybe related to MNG-2742 but this is not a plugin dependency.


-- 
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

        

Reply via email to