views:

38

answers:

1

Since Java 1.5 or so, javac has been looking into the manifest of third-party jars to find other jars. This causes a number of undesirable side-effects:

  1. As jar files have been renamed, we now get a flood of warnings whenever we compile (can be diabled with -Xlint:-path)
  2. Files we don't want on the classpath are being brought back onto it, even if they were left off it for a reason.
  3. Additional time is being taken in the build to look up all these additional jars, due to the resolution of this stuff we don't actually want.

So I was wondering if anyone knows the magic invocation to disable this. Assuming that Sun didn't saddle us with another feature we didn't want and can't turn off once we have it.

+1  A: 

Use bnd or shade to strip the offending MANIFEST.MF entry from the jars, instead of just renaming. Or take advantage of the face that these pathnames are essentially never absolute. If you move the jar named 'i-have-a-ClassPath.jar' into its own subdirectory, the manifest class path entries will fail to find these other jars in the expected locations. I suppose that will still whine if you turn on enough lint, though.

bmargulies