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 186208

Summary: Compilation problems when testing w/ many interdependent J2SE projects
Product: java Reporter: _ tboudreau <tboudreau>
Component: ProjectAssignee: Tomas Zezula <tzezula>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description _ tboudreau 2010-05-15 16:20:27 UTC
I am working on a project which contains many different interdependent projects (basically, a project structure like the NetBeans codebase, but using J2SEProject - it's just java libraries).  This team decided to use Ant + Ivy (we are not really using Ivy yet) instead of Maven.  However, this problem is confusing enough developers that it is really problematic.

Basically, *sometimes* you run tests in a project which depends on others which depend on others, and you get NoClassDefFoundErrors.  Other times it works correctly.

It appears that the errors happen if you have made changes in a dependent project (may require changing something > 1 level of indirection away).  Say you have a dependency graph like this (I am leaving a lot out, and the transient closure of each project *is* in its dependencies - I am just listing classes actually used):

mock.cloud
  cloud
     agent
        permissions
          util
     authentication
        localization
          util
        util
     model.user
           access
           localization
     model.resource

I can clean and build mock.cloud and run tests and it works fine.

However, if I make a change in, say, util, then I get a NoClassDefFoundError from, say, localization at runtime.

I *think* the problem is we are being too intelligent about the test classpath, and sometimes using build/classes (due to compile-on-save) as the classpath.  

What happens is:  If I am running against a built JAR, then the classpath includes the dependencies from the JAR's manifest.  If, at runtime, the classpath is build/classes for localization, then localization's dependency on util is missing.  So clean and build w/ dependencies fixes the problem, but it is very non-obvious what is wrong.

Maybe we should be using maven, but it would not be a good use of anyone's time to mavenize 24 interdependent projects.  The team I am helping has a bunch of users who are new to NetBeans, and some Eclipse and Intellij users.

I'll try to create a small test case to demonstrate the problem.
Comment 1 Tomas Zezula 2010-05-17 17:40:02 UTC
The j2seproject does not support the Class-Path attribute yet  issue #105927 and it will not help you as the jar may not exist. The NetBeans ant based projects have no transitive dependencies. When cloud depends on agent which depends on util, the cloud itself has to depend on util. Seems as a duplicate of #47507, but maybe I am wrong as I don't know all the project deps.
Comment 2 Tomas Zezula 2010-05-27 13:53:10 UTC
MArking as duplicate of #47507.

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