Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surefire can't find class org.apache.maven.plugin.surefire.log.api.ConsoleLogger #1367

Closed
sormuras opened this issue Apr 13, 2018 · 14 comments
Closed

Comments

@sormuras
Copy link
Member

Follow-up from #801 (comment)

@sormuras
Copy link
Member Author

Copied from #801 (comment) written by @joakime

--

There are 4 separate projects.
All 4 use the same version of maven-surefire-plugin

Project Name Description Behavior
junit5-forkcount-1 Junit 5 provider, Using <forkCount>1</forkCount> Crashes with org.apache.maven.plugin.PluginExecutionException 💥
junit5-forkmode-always Junit 5 provider, Using <forkMode>always</forkMode> Crashes with org.apache.maven.plugin.PluginExecutionException 💥
junit4-forkcount-1 Junit 4 default, Using <forkCount>1</forkCount> Terminates with org.apache.maven.plugin.MojoFailureException ✔️
junit4-forkmode-always Junit 4 default, Using <forkMode>always</forkMode> Terminates with org.apache.maven.plugin.MojoFailureException ✔️

So, there's 2 maven-surefire-plugin configurations that make the junit 5 surefire provider crash, but not the older junit 4 surefire provider ...

Scenario 1: forkCount with reuseForks

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.21.0</version>
        <configuration>
          <forkCount>1</forkCount>
          <reuseForks>false</reuseForks>
        </configuration>
      </plugin>

Scenario 1: forkMode = always

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.21.0</version>
        <configuration>
          <forkMode>always</forkMode>
        </configuration>
      </plugin>

@triceo
Copy link

triceo commented May 1, 2018

I am also seeing this. If reuseForks is set to true, Surefire will always crash with the CNFE and no tests are executed.

@Warfront1
Copy link

  • 1 Parallel runs don't seem to function properly, I attempted to resort to forkCount, and was met with the same error.
    Not sure if there is an additional error that is preventing me from running properly, or if this error specifically is the root cause.

In any case the error is consistent with OP's:
Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test failed: java.lang.ClassNotFoundException: org.apache.maven.plugin.surefire.log.api.ConsoleLogger

@bigkahuna1uk
Copy link

This is still broken. Have we an ETA when this will be fixed?

These are versions of plugins and JUnit 5 I'm using:

     <surefire.plugin.version>2.21.0</surefire.plugin.version>
    <dep.junit.jupiter.version>5.2.0</dep.junit.jupiter.version>
    <dep.junit.vintage.version>5.2.0</dep.junit.vintage.version>
    <dep.junit.platform.version>1.2.0</dep.junit.platform.version>

@marcphilipp
Copy link
Member

This issue will be solved as soon as Surefire has native support for the JUnit platform (cf. apache/maven-surefire#184).

For now, please add the following to the build > dependencies block of your POM:

    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-logger-api</artifactId>
      <version>2.21.0</version>
      <!-- to get around bug https://github.com/junit-team/junit5/issues/1367 -->
      <scope>test</scope>
      <optional>true</optional>
    </dependency>

@sormuras
Copy link
Member Author

@joakime @triceo @bigkahuna1uk @chibenwa As Surefire 2.22.0 is released, may you please re-run your setup and verify if the issue still persists using the latest-and-greatest version with native JUnit Platform support?

Thanks in advance.

@triceo
Copy link

triceo commented Jun 16, 2018

Works like a charm, @sormuras. Thanks!

@joakime
Copy link

joakime commented Jun 16, 2018

@sormuras we have enabled Surefire 2.22.0 in our junit5 branch - jetty/jetty.project@af7b52d

So far, with nearly a dozen features disabled, it seems to be working.
jacoco plugin doesn't work.
osgi paxexam doesn't like it.
Threaded testing with -T3 is broken at the moment too.
@{argLine} support seems to have been broken.
forkMode and forkCount haven't been tested properly (yet). (still chasing broken tests from the junit5 conversion)

@giacgbj
Copy link

giacgbj commented Jun 16, 2018

@joakime Just tried it and…I'm still using 2.19.1!

triceo added a commit to RoboZonky/robozonky that referenced this issue Jun 17, 2018
Brings native JUnit 5 support, fixing
junit-team/junit5#1367
@adamvoss
Copy link

When you update to Surefire 2.20.0, make sure to remove your junit-platform-surefire-provider plugin dependency declaration for the surefire plugin or you will keep getting this error.

@marcphilipp
Copy link
Member

@sormuras I think we can fix this issue now that Surefire 2.22.0 is released with native support for JUnit Platform, right?

@sormuras
Copy link
Member Author

Closing this issue -- please report new issues at https://maven.apache.org/surefire/issue-tracking.html

@silkentrance
Copy link

silkentrance commented Aug 21, 2018

Using [email protected] and versions of junit-jupiter(5.2.0) and junit-platform(1.2.0) here. When enabling

            <forkCount>3</forkCount>
            <reuseForks>true</reuseForks>

the plugin still fails with the same error.

@sbrannen
Copy link
Member

@silkentrance,

As @sormuras mentioned:

Closing this issue -- please report new issues at https://maven.apache.org/surefire/issue-tracking.html

I am therefore locking this issue.

Further discussions regarding Maven Surefire's support for the JUnit Platform should take place in the Maven Surefire issue tracker.

@junit-team junit-team locked and limited conversation to collaborators Aug 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants