RE: JUnit 5 test suites not running again

2022-07-09 Thread KARR, DAVID
I'd still appreciate more elaboration on your comments, but I guess what I'm 
going to attempt is to add exclusions in my parent pom for ALL of the 
junit-platform and junit-jupiter artifacts (because the spring starter 
artifacts include all of those) and then iteratively test removing the 
exclusions for only "junit-platform-suite-engine" and "junit-jupiter-engine" 
and see what doesn't work.

Note that our use cases are more complicated than that simple example.  We have 
to support both Junit 5 and Junit 4 mixed tests at this time.  That will 
definitely mean the junit-vintage-engine" will have to be included.

> -Original Message-
> From: KARR, DAVID 
> Sent: Friday, July 8, 2022 4:59 PM
> To: Maven Users List ; i...@soebes.de; David
> Karr 
> Subject: RE: JUnit 5 test suites not running again
> 
> Inline.
> 
> > -Original Message-
> > From: Karl Heinz Marbaise 
> > Sent: Friday, July 8, 2022 9:21 AM
> > To: David Karr ; i...@soebes.de
> > Cc: Maven Users List 
> > Subject: Re: JUnit 5 test suites not running again
> >
> > On 08.07.22 18:09, David Karr wrote:
> > > Inline.
> > >
> > > On Fri, Jul 8, 2022 at 8:17 AM Karl Heinz Marbaise
> > > mailto:khmarba...@gmx.de>> wrote:
> > >
> > > Hi,
> > >
> > > On 08.07.22 16:18, David Karr wrote:
> > >  > I had gotten help here with our JUnit 5 transition, and I
> > thought
> > > I had it
> > >  > all working, but now I see that I'm back to the state where
> our
> > > JUnit 5
> > >  > test suites are being ignored.
> > >  >
> > >  >>From what I understood, I had to ensure that
> > > "junit-platform-runner" was
> > >  > excluded as a dependency.  What I have seems to have done
> this,
> > > but only
> > >  > halfway.  The "dependency-tree" doesn't have that artifact.
> > > However, when
> > >  > I generated the effective pom, I DID see that artifact. I'm
> not
> > > sure what
> > >  > that means.
> > >  >
> > >  > I run this command line:
> > >  >
> > >  >      mvn -U -Dtest=ComponentTestSuite test
> > >  >
> > >  > Here's an excerpt of the output:
> > >  > --
> > >  > [INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test)
> @
> > >  > PlatformPilotMs ---
> > >  > [INFO] Using auto detected provider
> > >  > org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
> > >  > [INFO]
> > >  > [INFO] --
> -
> > >  > [INFO]  T E S T S
> > >  > [INFO] --
> -
> > >  > [INFO]
> > >  > [INFO] Results:
> > >  > [INFO]
> > >  > [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
> > >  > --
> > >  >
> > >  > As you can see, I'm using v3.0.0-M7 of Surefire. I'm using
> > v1.8.2 of
> > >  > junit-platform, and v5.8.2 of junit-jupiter.
> > >  >
> > >  > I've designed a parent pom hierarchy that looks like this:
> > >  >
> > >  > sdk-java-parent:
> > >  >    dependencyManagement includes "ext-bom" pom with scope
> > "import"
> > >  >    dependencies has a block like this:
> > >  > --
> > >  > 
> > >  >       ...
> > >  >       seed-sdk-core
> > >  >              
> > >  >                  
> > >  >                      org.junit.platform
> > >  >                      junit-platform-
> > runner
> > >  >                  
> > >  >              
> > >  >      
> > >  > --
> > >  >
> > >  > The effective pom also has this:
> > >  > --
> > >  > 
> > >  >      org.apache.maven.plugins
> > >  >      maven-surefire-plugin
> > >  >      3.0.0-M7
> > >  >      
> > >  >                      1
> > >  >                      false
> > >  >
> > >  > true
> > >  >      ${surefireArgLine}
> > >  >      false
> > >  >      
> > >  >          **/contract/*.java
> > >  >          **/integration/*.java
> > >  >          **/component/*.java
> > >  >      
> > >  >      
> > >  > 
> > >  > ---
> > >  >
> > >  > What could we be missing?
> > >  >
> > >
> > >
> > > Which dependencies do you have defined for running junit jupiter
> > tests?
> > >
> > >
> > > These are the resulting junit-jupiter dependencies in the effective
> > pom:
> > >
> > >          junit-jupiter
> > >          junit-jupiter-api
> > >          junit-jupiter-engine
> > >          junit-jupiter-migrationsupport
> > >          junit-jupiter-params
> >
> >
> > Migrationsupport means JUnit 4... not JUnit Jupiter..
> 
> Can you please say a little more about this?  How am I supposed to
> interpret this statement?
> 
> Note that I’m not including these dependencies explicitly.  I'm just
> including spring-boot-starter-test as a dependency, and I believe that
> is specifying all of 

Re: strange log in maven install

2022-07-09 Thread Tushar Kapila
No fix, just a suggestion,  why not make your code that validates the
output, more smart, to ignore these mixed lines. The end success msg must
still be intact?

On Fri, Jul 8, 2022, 22:58 Thai Le  wrote:

> Hello, I am using maven 3.8.2 on docker to build our projects and store the
> output to a text file to do some validation. From time to time, i got this
> in the log:
> 
> [INFO] --< org.springframework.boot:nccs-dispatcher
> >--
> [INFO] Building nccs-dispatcher 7.0.35-SNAPSHOT
> [83/91]
> [INFO] [ jar
> ]-
> [INFO] Downloading from bedatadriven:
>
> http://nexus-nexus-repository-manager.ncp-nexus.svc:8081/repository/bedatadriven/org/springframework/boot/spring-boot-starter-log4j2/2.3.4.RELEASE/spring-boot-starter-log4j2-2.3.4.RELEASE.pom
> [INFO] Downloading from io.cloudrepo:
>
> http://nexus-nexus-repository-manager.ncp-nexus.svc:8081/repository/maven-public/org/springframework/boot/spring-boot-starter-log4j2/2.3.4.RELEASE/spring-boot-starter-log4j2-2.3.4.RELEASE.pom
> [INFO] Downloaded from io.cloudrepo:
> http://nexus-nexus-repository-manager.ncp-next-compile) @
> lessor-accounting-engine ---
> [INFO] Changes detected - recompiling the module!
> 
> As you can see the last "Downloaded from..." line seems to be interfered
> with by some other text. This cause problem to my validator which check if
> any package is downloaded from a non-whitelisted repo. I am not sure how
> this happen since i did not enable parallel build. Here is my build
> command:
>
> docker run --name javaappbuild --rm \
> --volume "$core_services_dir":$mounted_core_services_dir \
> --volume "$cache_dir":$mounted_cache_dir \
> --workdir $mounted_core_services_dir \
>
> registry.gitlab.com/mycompany/core/core-services/ncp-maven:3.8-jdk-11-slim-http
> \
> mvn clean install \
> $maven_selective_option \
> -DskipTests=true \
> -DpipelineBuild=true \
> -Dmaven.repo.local=$mounted_cache_dir/.m2/ \
> --activate-profiles maven-profile \
> --batch-mode \
> --settings ${mounted_core_services_dir}/docker-build-settings.xml \
> -f $mounted_core_services_dir/all-modules-pom.xml \
> | tee -a "$cache_dir"/logs/mvn_build_core_services.txt
>
> Here is my maven version:
> root@a98ac9f70bbe:/# mvn --version
> Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
> Maven home: /usr/share/maven
> Java version: 11.0.12, vendor: Oracle Corporation, runtime:
> /usr/local/openjdk-11
> Default locale: en, platform encoding: UTF-8
> OS name: "linux", version: "5.13.0-52-generic", arch: "amd64", family:
> "unix"
>
> I have no clue at this point how to troubleshoot this since it does not
> always happen. If anyone has experienced similar behavior, please share you
> though
>


Re: Tricky dependencies in multi module projects

2022-07-09 Thread Niels Basjes
Hi,

If I set these dependencies to 'provided' I have not been able to ensure
they are actually inserted (and relocated) into the final shaded jar file.

Niels

On Fri, Jul 8, 2022 at 6:36 PM Jörg Schaible  wrote:

> Hi,
>
> simply declare the dependency with scope "provided" in the project that
> shades
> it.
>
> Regards,
> Jörg
>
> On Fritday, 8. July 2022, 17:43:16 CEST Francois Marot wote:
> > Hello Niels,
> >
> > I believe you used the shade maven plugin or equivalent. I faced this
> > problem multiple times and to my knowledge, there is no "good" solution.
> > The problem is that Maven computes the dependency graph for all modules
> of
> > the reactor right at the start. But when the shade plugin integrates
> ANTLR
> > inside your library, this library should not depend onto ANTLR anymore.
> But
> > because the dependency graph was computed at the start,
> > other modules of the reactor depending onto your library still depend
> onto
> > ANTLR even if there is already a shaded version of ANTLR inside your
> > library.
> >
> > So in the end, in the same reactor execution, module MUST NOT depend
> onto a
> > shaded module. They must be considered as 'final' modules.
> >
> > I hope this may help
> > François
> >
> >
> > *- - - - -François Marot06 50 91 96 38*
> >
> > Le ven. 8 juil. 2022 à 16:51, Niels Basjes  a écrit :
> > > Hi,
> > >
> > > I have a library project that uses dependencies that are prone to cause
> > > conflicts when another project wants to use my software.
> > > Antlr4 is a common example because it enforces the versions of the
> > > generated code and the runtime to be an exact match.
> > >
> > > In my maven project I have a main library and to avoid conflicts in
> > > downstream applications the antlr4-runtime has been shaded and
> relocated
> > > to
> > > a different package name.
> > > Using this modified jar in any project works as expected.
> > >
> > > When I want to use this in a different maven module of the same
> project it
> > > does not work like that.
> > > In my multi module maven project I found that the other modules (UDFs,
> > > demo
> > > webservlet, etc)  use the unshaded variant of the library, which
> sometimes
> > > causes conflicts.
> > > I think this is how the maven reactor is intended to work.
> > >
> > > Essentially I think I want to have the option to make a specific
> module of
> > > my project be built as-if it is an external project (i.e. "outside" the
> > > reactor).
> > >
> > > So far I have only found the invoker plugin to be a way to make this
> > > happen.
> > >
> > > What is the recommended way to handle this?
> > >
> > > --
> > > Best regards / Met vriendelijke groeten,
> > >
> > > Niels Basjes
>
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

-- 
Best regards / Met vriendelijke groeten,

Niels Basjes