question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mvn test fails to start on HEAD

See original GitHub issue

If I checkout 192e21a9fcacf4dffc975156bcf5e8ff7bf297b1 (HEAD right now), and run mvn test I see a ClassNotFoundException. It cannot even report success or failure of individual tests.

I believe this is related to https://github.com/kohsuke/github-api/pull/388 which upgraded jgit, but maybe not all of the unit tests. Specifically LifecycleTest references UsernamePasswordCredentialsProvider which is no longer in the newer versions of jgit.

I’ll be honest, as I tried to fix this I kept getting some unexpected classpath errors related to jgit (first this one, then one about GitAPIException, etc), and much as I know my way around a super complex build, I didn’t feel like learning about the maven plugin for bridge method generation, and everything else it might take me to sort this out. Is there something basic I missed for setting up a working development environment for this project? I feel like I must have missed something simple for mvn test not to work.

The surefire log shows:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jgit/transport/CredentialsProvider
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
        at java.lang.Class.getMethod0(Class.java:3018)
        at java.lang.Class.getMethod(Class.java:1784)
        at org.apache.maven.surefire.util.ReflectionUtils.tryGetMethod(ReflectionUtils.java:57)
        at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isSuiteOnly(JUnit3TestChecker.java:64)
        at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isValidJUnit3Test(JUnit3TestChecker.java:59)
        at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.accept(JUnit3TestChecker.java:54)
        at org.apache.maven.surefire.common.junit4.JUnit4TestChecker.accept(JUnit4TestChecker.java:51)
        at org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:97)
        at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:194)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:92)
        ... 9 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.jgit.transport.CredentialsProvider
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 22 more

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

Maven version:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
Maven home: C:\Program Files\Maven
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_121\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows nt (unknown)", version: "10.0", arch: "amd64", family: "dos"

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
gdgibcommented, Aug 30, 2018

Sorry I got grumpy, 6mo was a long wait. I don’t blame you for wanting it to go away! Me too!

Looks like your guess was good. Forcing a rebuild shows some weird warnings (why not errors, maven, seriously?) about stapler. I deleted that entry from the maven cache and things are at least running.

How in the HECK did you guess that? I’ve never seen a corrupt JAR in the maven cache before… Not that I fully understand their SHA1 sum mechanism, but apparently it aint good enough. That’ll be a problem for another day.

I was on the wrong track completely with bridge methods. I tried getting Eclipse to help debug this a bit, but the m2e integration doesn’t support that plugin. Red herring, my mistake.

For now, thank you so much sticking with me, and for the excellent guess. I’ll wonder more about maven cache corruption in the future, with classpath errors.

0reactions
kohsukecommented, Aug 30, 2018

By the way my environment:

% mvn --version Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T11:33:14-07:00) Maven home: /usr/local/maven3 Java version: 1.8.0_144, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_144/jre Default locale: en_US, platform encoding: UTF-8 OS name: “linux”, version: “4.4.0-130-generic”, arch: “amd64”, family: “unix”

Read more comments on GitHub >

github_iconTop Results From Across the Web

mvn test fails to start on HEAD · Issue #415 · hub4j/github-api
... (HEAD right now), and run mvn test I see a ClassNotFoundException. It cannot even report success or failure of individual tests.
Read more >
Maven test fails within install phase but is ok within test phase
After this fix "mvn clean test" runs ok, but "mvn clean install" fails with exact exception I suppose it's because integration-test phase.
Read more >
Why Maven Doesn't Find JUnit Tests to Run - Baeldung
When working with Maven projects, it's common for a developer to make a mistake that results in JUnit tests not running during a...
Read more >
Maven Error: Failed to collect dependencies - When trying to ...
Hi. I am facing an issue which started recently. I am facing an issue when trying to execute any Maven supported scenarios from...
Read more >
Karate | Test Automation Made Simple.
Karate is the only open-source tool to combine API test-automation, mocks, ... that these tests will not be picked up when invoking mvn...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found