Import scope only sets versions of dependency - not add it to dependency.

Please examine output of dependency:tree and look where is added
junit-platform-runner

pt., 17 cze 2022 o 20:47 David Karr <davidmichaelk...@gmail.com> napisał(a):

> Ok, what is the proper way to do that, considering I have the following in
> a bom imported by my parent pom:
> --------------------
>             <dependency>
>                 <groupId>org.junit</groupId>
>                 <artifactId>junit-bom</artifactId>
>                 <scope>import</scope>
>                 <type>pom</type>
>                 <version>5.8.2</version>
>             </dependency>
>             <!-- Spring Dependencies -->
>             <dependency>
>               <groupId>org.springframework.boot</groupId>
>               <artifactId>spring-boot-dependencies</artifactId>
>               <version>${spring-boot.version}</version>
>               <type>pom</type>
>               <scope>import</scope>
>             </dependency>
> --------------------
> Do I add an exclusion to one or both of these?
>
> On Fri, Jun 17, 2022 at 11:37 AM Slawomir Jaranowski <
> s.jaranow...@gmail.com>
> wrote:
>
> > Do you have on your classpath - junit-platform-runner?
> > Please remove it.
> >
> >
> > pt., 17 cze 2022 o 20:23 David Karr <davidmichaelk...@gmail.com>
> > napisał(a):
> >
> > > I'm posting a new note, as this might be a different issue.
> > >
> > > I recently got good advice on this list about how to properly specify
> the
> > > version overrides for the junit-bom artifacts.  When I implemented
> that,
> > I
> > > saw that I was consistently getting the correct versions for those
> > > artifacts.
> > >
> > > However, I'm now confused by the behavior that I'm seeing from
> > Surefire.  I
> > > currently have a mix of JUnit 4 and JUnit 5 tests.  I'm pretty sure
> that
> > I
> > > had this working before, but now I see that it is not running any of
> the
> > > JUnit 5 tests.
> > >
> > > Note the following excerpt from my build:
> > > -------------------
> > > [INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @
> > > PlatformPilotMs ---
> > > [INFO] Using auto detected provider
> > > org.apache.maven.surefire.junit4.JUnit4Provider
> > > ------------------
> > >
> > > I'm using the very latest M version, as that resolves other issues
> we've
> > > been having. When I look to see what tests were executed, I see that it
> > > doesn't include any of my JUnit 5 tests.
> > >
> > > I ran "mvn dependency:tree" to verify what versions of JUnit are in the
> > > classpath, and it has BOTH JUnit 4.13 and junit-platform 1.8.2 and
> > > junit-jupiter 5.8.2.  The surefire doc page says "Surefire normally
> > > automatically selects which test-framework provider to use based on the
> > > version of TestNG/JUnit present in your project's classpath". Is the
> fact
> > > that both are in the classpath causing this? Am I going to have to
> > manually
> > > specify both the junit 4 and junit 5 providers in the surefire
> > > dependencies? That is additionally annoying as I also have to
> redundantly
> > > specify the versions of those artifacts (I tried not specifying a
> > version,
> > > and it complained).
> > >
> >
> >
> > --
> > Sławomir Jaranowski
> >
>


-- 
Sławomir Jaranowski

Reply via email to