You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dan Tran <da...@gmail.com> on 2017/05/05 07:51:16 UTC
Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier
Hi
Lately, my build randomly fails with
java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier
at surefire
My environment consists of
* 200+ modules running with --builder smart -T 4
* surefire 2.19.1 and 2.20, maven 3.3.9 and 3.5
* Build runs on Sles12SP2 with OpenJDK8
Stack Overflow has a similar issue back in 2014
Any suggestion helping to trouble shoot this issue is greatly appreciated
Thanks
-Dan
Re: Intermittent java.lang.NoClassDefFoundError:
org/junit/runner/notification/RunNotifier
Posted by Fabian van der Veen <F....@topdesk.com>.
Hey Dan,
Given the symptoms you mention, I think you may be hitting the same issue with your concurrent build as we did a while ago (and which has been reported as https://issues.apache.org/jira/browse/MNG-5960).
Basically, (based on some debugging I did for our build,) having some aggregate plugin running in anything else than your root project may cause this to happen in a multi-threaded build. In our case, it was the default behaviour of the maven-javadoc-plugin. In short, it boils down to the aggregate plugin resolving compile-scope dependencies for _all_ projects in the reactor, which may possibly overwrite already resolved test-scope dependencies for currently building projects; resulting in classpath issues (usually) no longer being able to find junit.
I don't know if there is an easy way to find aggregate plugins other than looking into their mojo source code; so maybe someone else on this list can help you with that..
Good luck!
-- Fabian
On Fri, 2017-05-05 at 00:51 -0700, Dan Tran wrote:
Hi
Lately, my build randomly fails with
java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier
at surefire
My environment consists of
* 200+ modules running with --builder smart -T 4
* surefire 2.19.1 and 2.20, maven 3.3.9 and 3.5
* Build runs on Sles12SP2 with OpenJDK8
Stack Overflow has a similar issue back in 2014
Any suggestion helping to trouble shoot this issue is greatly appreciated
Thanks
-Dan
Re: Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier
Posted by Dan Tran <da...@gmail.com>.
@Fabian, one more time you have come to my rescue. Indeed, we introduce a
new MOJO and it has aggregate flag set to true
Thanks again
-Dan
On Fri, May 5, 2017 at 8:56 AM, Dan Tran <da...@gmail.com> wrote:
> @Fabian, yes i do recall vaguely with your and I have a good run for a
> year :-). Thanks for the reminder, i can search thru new mojos lately
> introduced to the build and find out. Thanks
>
> @Martin, i do use hamcrest
>
> -D
>
> On Fri, May 5, 2017 at 4:42 AM, Martin Gainty <mg...@hotmail.com> wrote:
>
>>
>>
>> ________________________________
>> From: Dan Tran <da...@gmail.com>
>> Sent: Friday, May 5, 2017 3:51 AM
>> To: Maven Users List
>> Subject: Intermittent java.lang.NoClassDefFoundError:
>> org/junit/runner/notification/RunNotifier
>>
>> Hi
>>
>> Lately, my build randomly fails with
>>
>> java.lang.NoClassDefFoundError: org/junit/runner/notification/
>> RunNotifier
>> at surefire
>>
>>
>> My environment consists of
>>
>> * 200+ modules running with --builder smart -T 4
>> * surefire 2.19.1 and 2.20, maven 3.3.9 and 3.5
>> * Build runs on Sles12SP2 with OpenJDK8
>>
>> Stack Overflow has a similar issue back in 2014
>>
>> MG>assuming you are not using Hamcrest following surefire doc i assume
>> declaring junit-dep as dependency to maven-surefire-plugin will solve
>>
>> <dependencies>
>> <dependency>
>> <groupId>junit</groupId>
>> <artifactId>junit-dep</artifactId>
>>
>> <scope>test</scope>
>> </dependency>
>>
>> MG>http://maven.apache.org/surefire/maven-surefire-plugin/
>> examples/junit.html
>> <http://maven.apache.org/surefire/maven-surefire-plugin/
>> examples/junit.html>
>> Maven Surefire Plugin – Using JUnit<http://maven.apache.org/
>> surefire/maven-surefire-plugin/examples/junit.html>
>> maven.apache.org
>> This is the only step that is required to get started - you can now
>> create tests in your test source directory (e.g., src/test/java). Surefire
>> supports three ...
>>
>> MG>once junit added as dependency supposedly surefire test classloader
>> will now see junit classes (including org/junit/runner/notification/
>> RunNotifier)
>> MG>does this help?
>>
>>
>> Any suggestion helping to trouble shoot this issue is greatly appreciated
>>
>> Thanks
>>
>> -Dan
>>
>
>
Re: Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier
Posted by Dan Tran <da...@gmail.com>.
@Fabian, yes i do recall vaguely with your and I have a good run for a year
:-). Thanks for the reminder, i can search thru new mojos lately introduced
to the build and find out. Thanks
@Martin, i do use hamcrest
-D
On Fri, May 5, 2017 at 4:42 AM, Martin Gainty <mg...@hotmail.com> wrote:
>
>
> ________________________________
> From: Dan Tran <da...@gmail.com>
> Sent: Friday, May 5, 2017 3:51 AM
> To: Maven Users List
> Subject: Intermittent java.lang.NoClassDefFoundError:
> org/junit/runner/notification/RunNotifier
>
> Hi
>
> Lately, my build randomly fails with
>
> java.lang.NoClassDefFoundError: org/junit/runner/notification/
> RunNotifier
> at surefire
>
>
> My environment consists of
>
> * 200+ modules running with --builder smart -T 4
> * surefire 2.19.1 and 2.20, maven 3.3.9 and 3.5
> * Build runs on Sles12SP2 with OpenJDK8
>
> Stack Overflow has a similar issue back in 2014
>
> MG>assuming you are not using Hamcrest following surefire doc i assume
> declaring junit-dep as dependency to maven-surefire-plugin will solve
>
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit-dep</artifactId>
>
> <scope>test</scope>
> </dependency>
>
> MG>http://maven.apache.org/surefire/maven-surefire-
> plugin/examples/junit.html
> <http://maven.apache.org/surefire/maven-surefire-
> plugin/examples/junit.html>
> Maven Surefire Plugin – Using JUnit<http://maven.apache.org/
> surefire/maven-surefire-plugin/examples/junit.html>
> maven.apache.org
> This is the only step that is required to get started - you can now create
> tests in your test source directory (e.g., src/test/java). Surefire
> supports three ...
>
> MG>once junit added as dependency supposedly surefire test classloader
> will now see junit classes (including org/junit/runner/notification/
> RunNotifier)
> MG>does this help?
>
>
> Any suggestion helping to trouble shoot this issue is greatly appreciated
>
> Thanks
>
> -Dan
>
Re: Intermittent java.lang.NoClassDefFoundError:
org/junit/runner/notification/RunNotifier
Posted by Martin Gainty <mg...@hotmail.com>.
________________________________
From: Dan Tran <da...@gmail.com>
Sent: Friday, May 5, 2017 3:51 AM
To: Maven Users List
Subject: Intermittent java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier
Hi
Lately, my build randomly fails with
java.lang.NoClassDefFoundError: org/junit/runner/notification/RunNotifier
at surefire
My environment consists of
* 200+ modules running with --builder smart -T 4
* surefire 2.19.1 and 2.20, maven 3.3.9 and 3.5
* Build runs on Sles12SP2 with OpenJDK8
Stack Overflow has a similar issue back in 2014
MG>assuming you are not using Hamcrest following surefire doc i assume declaring junit-dep as dependency to maven-surefire-plugin will solve
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<scope>test</scope>
</dependency>
MG>http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html
<http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html>
Maven Surefire Plugin – Using JUnit<http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html>
maven.apache.org
This is the only step that is required to get started - you can now create tests in your test source directory (e.g., src/test/java). Surefire supports three ...
MG>once junit added as dependency supposedly surefire test classloader will now see junit classes (including org/junit/runner/notification/RunNotifier)
MG>does this help?
Any suggestion helping to trouble shoot this issue is greatly appreciated
Thanks
-Dan