Re: Surefire 3.0.0-M4 not failing build on errors

2020-06-14 Thread Tibor Digana
Now we are able to handle the errors on the class level.
Before in 2.22.x and in M4 we handled the test errors only and ignored the
class level errors.

I would trust NoClassDefFoundError because ControllerAdvice really could
not be found in IntelliJ IDEA.
So the IDE is telling me the same thing, and this is perhaps the root cause
for NoSuchBeanDefinitionException. You know your application better than
me.

Even if i use the IntelliJ IDEA and run the tests, i get the same error on
the console:

Test ignored.

*java.lang.NoClassDefFoundError:
org/springframework/web/bind/annotation/ControllerAdvice*
at
org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTypeExcludeFilter.(WebMvcTypeExcludeFilter.java:59)
...
Suppressed: java.lang.NoClassDefFoundError: Could not initialize class
org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTypeExcludeFilter
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at
java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
...
Caused by: java.lang.ClassNotFoundException:
org.springframework.web.bind.annotation.ControllerAdvice
at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 61 more








On Sat, Jun 13, 2020 at 10:51 PM Jeff Jensen  wrote:

> Great news that it fails!  Thank you Tibor.
>
> I note it emits a different exception than with 2.22.2 or running in IDE.
> 2.22.2 emits an IllegalStateException with root
> NoSuchBeanDefinitionException but per below M5 emits NoClassDefFoundError.
> Is this ok because you changed something locally or is this a concern?
>
>
> On Sat, Jun 13, 2020 at 12:47 PM Tibor Digana 
> wrote:
>
> > We have changed the resolution of junit5 engines 2 times.
> > Now I have got the result with 3.0.0-M5. I think it is what you expect:
> >
> > [INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @
> > surefire-no-build-fail ---
> > [INFO]
> > [INFO] ---
> > [INFO]  T E S T S
> > [INFO] ---
> > [INFO] Running com.jeffjensen.surefire.ApplicationTest
> > 19:43:18.789 [main] DEBUG
> org.springframework.test.context.BootstrapUtils -
> > Instantiating CacheAwareContextLoaderDelegate from class
> >
> >
> [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
> > 19:43:18.821 [main] DEBUG
> org.springframework.test.context.BootstrapUtils -
> > Instantiating BootstrapContext using constructor [public
> >
> >
> org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
> > 19:43:18.910 [main] DEBUG
> org.springframework.test.context.BootstrapUtils -
> > Instantiating TestContextBootstrapper for test class
> > [com.jeffjensen.surefire.ApplicationTest] from class
> >
> >
> [org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTestContextBootstrapper]
> > 19:43:18.944 [main] INFO
> >
> >
> org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTestContextBootstrapper
> > - Neither @ContextConfiguration nor @ContextHierarchy found for test
> class
> > [com.jeffjensen.surefire.ApplicationTest], using SpringBootContextLoader
> > 19:43:18.951 [main] DEBUG
> > org.springframework.test.context.support.AbstractContextLoader - Did not
> > detect default resource location for test class
> > [com.jeffjensen.surefire.ApplicationTest]: class path resource
> > [com/jeffjensen/surefire/ApplicationTest-context.xml] does not exist
> > 19:43:18.952 [main] DEBUG
> > org.springframework.test.context.support.AbstractContextLoader - Did not
> > detect default resource location for test class
> > [com.jeffjensen.surefire.ApplicationTest]: class path resource
> > [com/jeffjensen/surefire/ApplicationTestContext.groovy] does not exist
> > 19:43:18.952 [main] INFO
> > org.springframework.test.context.support.AbstractContextLoader - Could
> not
> > detect default resource locations for test class
> > [com.jeffjensen.surefire.ApplicationTest]: no resource found for suffixes
> > {-context.xml, Context.groovy}.
> > 19:43:18.953 [main] INFO
> >
> org.springframework.test.context.support.AnnotationConfigContextLoaderUtils
> > - Could not detect default configuration classes for test class
> > [com.jeffjensen.surefire.ApplicationTest]: ApplicationTest does not
> declare
> > any static, non-private, non-final, nested classes annotated with
> > @Configuration.
> > 19:43:19.024 [main] DEBUG
> org.springframework.test.context.BootstrapUtil

Re: Surefire 3.0.0-M4 not failing build on errors

2020-06-14 Thread Jeff Jensen
Thank you for explaining.  Yes, turns out a dependency is missing in my
reproducer and looks like M5 correctly detects that error; that's great
news.

Interestingly, if I correct that by adding the dep, M4 correctly works with
this reproducer too, so it's not a reproducer of the intended error!  That
is not the problem in the customer app though - both 2.22.2 and IDEA detect
the NoSuchBeanDefinitionException in it.

Thanks again for the help; looking forward to M5 release.


On Sun, Jun 14, 2020 at 3:55 AM Tibor Digana  wrote:

> Now we are able to handle the errors on the class level.
> Before in 2.22.x and in M4 we handled the test errors only and ignored the
> class level errors.
>
> I would trust NoClassDefFoundError because ControllerAdvice really could
> not be found in IntelliJ IDEA.
> So the IDE is telling me the same thing, and this is perhaps the root cause
> for NoSuchBeanDefinitionException. You know your application better than
> me.
>
> Even if i use the IntelliJ IDEA and run the tests, i get the same error on
> the console:
>
> Test ignored.
>
> *java.lang.NoClassDefFoundError:
> org/springframework/web/bind/annotation/ControllerAdvice*
> at
>
> org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTypeExcludeFilter.(WebMvcTypeExcludeFilter.java:59)
> ...
> Suppressed: java.lang.NoClassDefFoundError: Could not initialize class
>
> org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTypeExcludeFilter
> at
>
> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> at
>
> java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> at
>
> java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at
>
> java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
> ...
> Caused by: java.lang.ClassNotFoundException:
> org.springframework.web.bind.annotation.ControllerAdvice
> at
>
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
> at
>
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
> ... 61 more
>
>
>
>
>
>
>
>
> On Sat, Jun 13, 2020 at 10:51 PM Jeff Jensen  wrote:
>
> > Great news that it fails!  Thank you Tibor.
> >
> > I note it emits a different exception than with 2.22.2 or running in IDE.
> > 2.22.2 emits an IllegalStateException with root
> > NoSuchBeanDefinitionException but per below M5 emits
> NoClassDefFoundError.
> > Is this ok because you changed something locally or is this a concern?
> >
> >
> > On Sat, Jun 13, 2020 at 12:47 PM Tibor Digana 
> > wrote:
> >
> > > We have changed the resolution of junit5 engines 2 times.
> > > Now I have got the result with 3.0.0-M5. I think it is what you expect:
> > >
> > > [INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @
> > > surefire-no-build-fail ---
> > > [INFO]
> > > [INFO] ---
> > > [INFO]  T E S T S
> > > [INFO] ---
> > > [INFO] Running com.jeffjensen.surefire.ApplicationTest
> > > 19:43:18.789 [main] DEBUG
> > org.springframework.test.context.BootstrapUtils -
> > > Instantiating CacheAwareContextLoaderDelegate from class
> > >
> > >
> >
> [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
> > > 19:43:18.821 [main] DEBUG
> > org.springframework.test.context.BootstrapUtils -
> > > Instantiating BootstrapContext using constructor [public
> > >
> > >
> >
> org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
> > > 19:43:18.910 [main] DEBUG
> > org.springframework.test.context.BootstrapUtils -
> > > Instantiating TestContextBootstrapper for test class
> > > [com.jeffjensen.surefire.ApplicationTest] from class
> > >
> > >
> >
> [org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTestContextBootstrapper]
> > > 19:43:18.944 [main] INFO
> > >
> > >
> >
> org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTestContextBootstrapper
> > > - Neither @ContextConfiguration nor @ContextHierarchy found for test
> > class
> > > [com.jeffjensen.surefire.ApplicationTest], using
> SpringBootContextLoader
> > > 19:43:18.951 [main] DEBUG
> > > org.springframework.test.context.support.AbstractContextLoader - Did
> not
> > > detect default resource location for test class
> > > [com.jeffjensen.surefire.ApplicationTest]: class path resource
> > > [com/jeffjensen/surefire/ApplicationTest-context.xml] does not exist
> > > 19:43:18.952 [main] DEBUG
> > > org.springframework.test.context.support.AbstractContextLoader - Did
> not
> > > detect default resource location for test class
> > > [com.jeffjensen.surefire.ApplicationTest]: class path resource
> > > [com/jeffj

Re: Maven Artifacts not consumable after Introducing ci-friendly approach - revision tag

2020-06-14 Thread Hanish Bansal
Hi All,

Thanks for your response.

I have replicated the same issue as mentioned in below steps:
1. Compile external project https://github.com/hanishbansal/external-common ,
this is some external project in which we can not change anything.
2. Our project "test-parent" has dependency of "external-common" project.
Now checkout code from https://github.com/hanishbansal/test-parent adn try
to compile it. Module "child1" is not deployed properly in local maven repo.
Below is pom snippet of child1 module where revision tag is not replaced.
 
test-parent
com.sample
${revision}
  
  4.0.0
  child1





On Sat, Jun 13, 2020 at 8:18 PM Tomo Suzuki 
wrote:

> Hi Hanish,
>
> I see child1 in my Maven local repository cannot resolve the $version to
> refer to its parent, because $version is defined at the parent (the error
> message below).
>
> How about specifying the concrete version when specifying parent? While you
> might not like that the version value will appear multiple places, you can
> update them by "mvn version:set"
> https://www.mojohaus.org/versions-maven-plugin/set-mojo.html
>
>
> [ERROR] Failed to execute goal on project child2: Could not resolve
> dependencies for project com.sample:child2:jar:1.1.0-SNAPSHOT: Failed to
> collect dependencies at com.sample:child1:jar:1.1.0-SNAPSHOT: Failed to
> read artifact descriptor for com.sample:child1:jar:1.1.0-SNAPSHOT: Could
> not find artifact com.sample:test-parent:pom:${revision} in central (
> https://repo.maven.apache.org/maven2) -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
> switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions,
> please read the following articles:
> [ERROR] [Help 1]
>
> http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
>
> /tmp/test-parent/child2 $ cat
> ~/.m2/repository/com/sample/child1/1.1.0-SNAPSHOT/child1-1.1.0-SNAPSHOT.pom
> http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
> http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>   4.0.0
>   
> com.sample
> test-parent
> ${revision}
>   
>   child1
> %
>
> On Sat, Jun 13, 2020 at 8:41 AM Francois Marot 
> wrote:
>
> > Hello,
> > I can confirm that you sample project works as intended once you add the
> > missing configuration for the flatten plugin. Without it the pom.xml
> > installed in your local repo are not correct because of the placeholders
> in
> > the .
> >
> > I just copy pasted the  content as explained here:
> > http://maven.apache.org/maven-ci-friendly.html#install-deploy
> >
> > Hope you will soon make it work
> >
> >
> >
> > *- - - - -François Marot06 50 91 96 38*
> >
> >
> >
> > On Sat, 13 Jun 2020 at 05:39, Hanish Bansal <
> > hanish.bansal.agar...@gmail.com>
> > wrote:
> >
> > > Hi Team,
> > >
> > > I have pushed a sample minimal project in git at the following link
> > > https://github.com/hanishbansal/test-parent
> > >
> > > Project Structure:
> > >   test-parent
> > >- child1
> > >- child2
> > >
> > > child2 project has dependency of child1 project.
> > >
> > > Steps to Reproduce the error:
> > > 1. Compile test-parent project with goal "clean install". It will
> compile
> > > and install all child projects.
> > > 2. Now compile child2 project, it would give compilation error due to
> > > dependency of child1 project.
> > >
> > >
> > >
> > > On Sat, Jun 13, 2020 at 12:58 AM Tomo Suzuki
>  > >
> > > wrote:
> > >
> > > > I suspect typo in child module name. Do you want to share minimum
> > > > reproducible project?
> > > >
> > > > On Fri, Jun 12, 2020 at 07:17 Hanish Bansal <
> > > > hanish.bansal.agar...@gmail.com>
> > > > wrote:
> > > >
> > > > > Yes, that has been already tried. I have installed child modules
> > > > separately
> > > > > but if there is any child module (e.g. child2) has dependency of
> > other
> > > > > child module child1 then I am not able to compile child2 project.
> > > > >
> > > > > On Fri, Jun 12, 2020 at 3:39 PM Tomo Suzuki
> >  > > >
> > > > > wrote:
> > > > >
> > > > > > (Assuming yy-utils is the one of the child project)
> > > > > > Run ”mvn install” in yy-utils module first.
> > > > > >
> > > > > > On Fri, Jun 12, 2020 at 01:56 Hanish Bansal <
> > > > > > hanish.bansal.agar...@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > Hi All,
> > > > > > >
> > > > > > > We have maven Multi Module Project, where we have recently
> > > > implemented
> > > > > > > version control process as mentioned in below documentation but
> > > after
> > > > > > > introducing it we are not able to compile child projects
> > > > independently
> > > > > > > because of dependency failure.
> > > > > > >
> > http://maven.apache.org/maven-ci-friendly.html#multi-module-setup
> > > > > > >
> > > > > > > We have al