1

I have a diificult ClassDefNotFound problem (see here) I run my unit tests through maven surefire plugin.

I would like to print out my unit test classpath at runtime. The following code only outputs one entry, namely the surefire jar. (I guess surefire has its own classloader and is using reflection.)

@Test
public void testGetClasspathTest()
{
     ClassLoader cl = ClassLoader.getSystemClassLoader();

        URL[] urls = ((URLClassLoader)cl).getURLs();

        for(URL url: urls){
            TestSS.getLogger().debug(url.getFile());
        }
}

Can someone suggest a way to get the full runtime classpath from within a junit test?

Community
  • 1
  • 1
Jake
  • 4,322
  • 6
  • 39
  • 83

1 Answers1

2

the answer is simple:

mvn -e -X install

This provides full debug output including test runtime classpath

Jake
  • 4,322
  • 6
  • 39
  • 83