This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 189084

Summary: Incorrect artifact resolution: inherited indirect vs. explicit provided
Product: projects Reporter: Jesse Glick <jglick>
Component: MavenAssignee: Jesse Glick <jglick>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 7.0   
Hardware: PC   
OS: Linux   
URL: https://guest:@stapler.dev.java.net/svn/stapler/tags/stapler-parent-1.148/core/src/test/java/org/kohsuke/stapler/MockServletContext.java
Issue Type: DEFECT Exception Reporter:

Description Jesse Glick 2010-07-30 15:30:06 UTC
The source file indicated in the URL shows error badges when opened in the IDE (build tree then open parent w/ required projects), but compiles cleanly with Maven 2.2.1 or 3.0-beta-1. (Neighboring MockRequest is similar.) The project POM says

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.3</version>
      <scope>provided</scope>
    </dependency>

and the parent POM has

    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty</artifactId>
      <version>6.1.11</version>
      <scope>test</scope>
    </dependency>

which indirectly includes org.mortbay.jetty:servlet-api-2.5:6.1.11:jar. Maven seems to give precedence to the 2.3 Servlet API in provided scope, thus permitting MockServletContext to implement ServletContext. But NB seems to give precedence to the 2.5 API inherited from Jetty, so the NB editor complains that getContextPath() is unimplemented.

Workaround is to add

      <exclusions>
        <exclusion>
          <artifactId>servlet-api-2.5</artifactId>
          <groupId>org.mortbay.jetty</groupId>
        </exclusion>
      </exclusions>

to the parent POM and restart the IDE after deleting $userdir/var/cache/index.
Comment 1 Jesse Glick 2010-10-05 22:03:45 UTC
Seems fixed by M3 embedder.

*** This bug has been marked as a duplicate of bug 188871 ***