You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Karr <da...@gmail.com> on 2022/06/16 21:54:48 UTC

How to properly override junit-platform and junit-jupiter in a parent pom

We have a bunch of services running Spring Boot 2.3.12, which by default
uses junit-platform 1.6.3 and junit-jupiter 5.6.3.

We are trying to instead use junit-platform 1.8.2 and junit-jupiter 5.8.2.
All the artifacts and versions we need are in junit-bom-5.8.2.

We want to control this in our parent pom(s), as we have dozens of similar
services all using the same parent pom.

I thought I had this working, but now it appears it's not, and I'm not sure
what I'm missing.

At one time I had thought all I had to do was include junit-bom v5.8.2 in
the "dependencies" list in the parent pom, but that never worked.  For lack
of any other solution, I simply pasted the contents of the "dependencies"
list from junit-bom-5.8.2 into the "dependencies" list of my parent pom.
At one point, I thought this was working.

Today, I'm looking at one service that uses that parent pom, but for some
reason it's not getting the newer versions of the artifacts, it's still
getting 1.6.3 and 5.6.3.  I'm looking at both "mvn dependency:tree" and the
"Dependency Hierarchy" view in Eclipse.  I'm not completely certain how to
interpret what I'm seeing.

The first thing I want to know is what is the best way to do this sort of
thing.  I find it hard to believe pasting the entire contents of the bom
that I want into the parent pom was the right way to do it, but I couldn't
get it to work any other way, and now it's not working anyway.

I can provide more details of specific poms and parent poms, but I wanted
to see if there was a simple solution first.

I am basically aware of the difference between "dependencyManagement" and
"dependencies" in a parent pom.

Re: How to properly override junit-platform and junit-jupiter in a parent pom

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

On 17.06.22 02:27, David Karr wrote:
> Sorry, can you clarify exactly what you mean by that?


Usually you have something in your pom file to use the spring boot
dependencies:


<dependencyManagement>
         <dependencies>
             <dependency>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-dependencies</artifactId>
                 <version>2.3.12.RELEASE</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
         </dependencies>
</dependencyManagement>


That means by default you will use the junit-jupiter version which is
defined by the spring-boot-dependencies.

If you like to overwrite that you have to define the junit-bom before
the spring boot dependencies like this:

     <dependencyManagement>
         <dependencies>
             <dependency>
                 <groupId>org.junit</groupId>
                 <artifactId>junit-bom</artifactId>
                 <version>5.8.2</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
             <dependency>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-dependencies</artifactId>
                 <version>2.3.12.RELEASE</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
         </dependencies>
     </dependencyManagement>



After using this in your parent pom all of the junit jupiter
dependencies have to be in version 5.8.2....

Furthermore if you check the dependency tree via

mvn dependency:tree

you should check which version of the maven-dependency-plugin you are
using? (Most recent one?)...

PS.: The version of spring boot which is used is already out of support
(https://spring.io/projects/spring-boot#support).

Kind regards
Karl Heinz Marbaise

>
> On Thu, Jun 16, 2022 at 4:14 PM Karl Heinz Marbaise <kh...@gmx.de>
> wrote:
>
>> Hi,
>>
>> It's important to define the junit-bom import before the
>> spring-boot-dependencies import part in dependencyManagement which assumes
>> you don't use spring-boot-parent?
>>
>> Kind regards
>> Karl Heinz Marbaise
>>
>>
>> On 16.06.22 23:54, David Karr wrote:
>>> We have a bunch of services running Spring Boot 2.3.12, which by default
>>> uses junit-platform 1.6.3 and junit-jupiter 5.6.3.
>>>
>>> We are trying to instead use junit-platform 1.8.2 and junit-jupiter
>> 5.8.2.
>>> All the artifacts and versions we need are in junit-bom-5.8.2.
>>>
>>> We want to control this in our parent pom(s), as we have dozens of
>> similar
>>> services all using the same parent pom.
>>>
>>> I thought I had this working, but now it appears it's not, and I'm not
>> sure
>>> what I'm missing.
>>>
>>> At one time I had thought all I had to do was include junit-bom v5.8.2 in
>>> the "dependencies" list in the parent pom, but that never worked.  For
>> lack
>>> of any other solution, I simply pasted the contents of the "dependencies"
>>> list from junit-bom-5.8.2 into the "dependencies" list of my parent pom.
>>> At one point, I thought this was working.
>>>
>>> Today, I'm looking at one service that uses that parent pom, but for some
>>> reason it's not getting the newer versions of the artifacts, it's still
>>> getting 1.6.3 and 5.6.3.  I'm looking at both "mvn dependency:tree" and
>> the
>>> "Dependency Hierarchy" view in Eclipse.  I'm not completely certain how
>> to
>>> interpret what I'm seeing.
>>>
>>> The first thing I want to know is what is the best way to do this sort of
>>> thing.  I find it hard to believe pasting the entire contents of the bom
>>> that I want into the parent pom was the right way to do it, but I
>> couldn't
>>> get it to work any other way, and now it's not working anyway.
>>>
>>> I can provide more details of specific poms and parent poms, but I wanted
>>> to see if there was a simple solution first.
>>>
>>> I am basically aware of the difference between "dependencyManagement" and
>>> "dependencies" in a parent pom.
>>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to properly override junit-platform and junit-jupiter in a parent pom

Posted by David Karr <da...@gmail.com>.
If it matters, I see that in our parent bom artifact, we are importing
"spring-boot-dependencies".

On Thu, Jun 16, 2022 at 5:27 PM David Karr <da...@gmail.com>
wrote:

> Sorry, can you clarify exactly what you mean by that?
>
> On Thu, Jun 16, 2022 at 4:14 PM Karl Heinz Marbaise <kh...@gmx.de>
> wrote:
>
>> Hi,
>>
>> It's important to define the junit-bom import before the
>> spring-boot-dependencies import part in dependencyManagement which assumes
>> you don't use spring-boot-parent?
>>
>> Kind regards
>> Karl Heinz Marbaise
>>
>>
>> On 16.06.22 23:54, David Karr wrote:
>> > We have a bunch of services running Spring Boot 2.3.12, which by default
>> > uses junit-platform 1.6.3 and junit-jupiter 5.6.3.
>> >
>> > We are trying to instead use junit-platform 1.8.2 and junit-jupiter
>> 5.8.2.
>> > All the artifacts and versions we need are in junit-bom-5.8.2.
>> >
>> > We want to control this in our parent pom(s), as we have dozens of
>> similar
>> > services all using the same parent pom.
>> >
>> > I thought I had this working, but now it appears it's not, and I'm not
>> sure
>> > what I'm missing.
>> >
>> > At one time I had thought all I had to do was include junit-bom v5.8.2
>> in
>> > the "dependencies" list in the parent pom, but that never worked.  For
>> lack
>> > of any other solution, I simply pasted the contents of the
>> "dependencies"
>> > list from junit-bom-5.8.2 into the "dependencies" list of my parent pom.
>> > At one point, I thought this was working.
>> >
>> > Today, I'm looking at one service that uses that parent pom, but for
>> some
>> > reason it's not getting the newer versions of the artifacts, it's still
>> > getting 1.6.3 and 5.6.3.  I'm looking at both "mvn dependency:tree" and
>> the
>> > "Dependency Hierarchy" view in Eclipse.  I'm not completely certain how
>> to
>> > interpret what I'm seeing.
>> >
>> > The first thing I want to know is what is the best way to do this sort
>> of
>> > thing.  I find it hard to believe pasting the entire contents of the bom
>> > that I want into the parent pom was the right way to do it, but I
>> couldn't
>> > get it to work any other way, and now it's not working anyway.
>> >
>> > I can provide more details of specific poms and parent poms, but I
>> wanted
>> > to see if there was a simple solution first.
>> >
>> > I am basically aware of the difference between "dependencyManagement"
>> and
>> > "dependencies" in a parent pom.
>> >
>>
>>

Re: How to properly override junit-platform and junit-jupiter in a parent pom

Posted by David Karr <da...@gmail.com>.
Sorry, can you clarify exactly what you mean by that?

On Thu, Jun 16, 2022 at 4:14 PM Karl Heinz Marbaise <kh...@gmx.de>
wrote:

> Hi,
>
> It's important to define the junit-bom import before the
> spring-boot-dependencies import part in dependencyManagement which assumes
> you don't use spring-boot-parent?
>
> Kind regards
> Karl Heinz Marbaise
>
>
> On 16.06.22 23:54, David Karr wrote:
> > We have a bunch of services running Spring Boot 2.3.12, which by default
> > uses junit-platform 1.6.3 and junit-jupiter 5.6.3.
> >
> > We are trying to instead use junit-platform 1.8.2 and junit-jupiter
> 5.8.2.
> > All the artifacts and versions we need are in junit-bom-5.8.2.
> >
> > We want to control this in our parent pom(s), as we have dozens of
> similar
> > services all using the same parent pom.
> >
> > I thought I had this working, but now it appears it's not, and I'm not
> sure
> > what I'm missing.
> >
> > At one time I had thought all I had to do was include junit-bom v5.8.2 in
> > the "dependencies" list in the parent pom, but that never worked.  For
> lack
> > of any other solution, I simply pasted the contents of the "dependencies"
> > list from junit-bom-5.8.2 into the "dependencies" list of my parent pom.
> > At one point, I thought this was working.
> >
> > Today, I'm looking at one service that uses that parent pom, but for some
> > reason it's not getting the newer versions of the artifacts, it's still
> > getting 1.6.3 and 5.6.3.  I'm looking at both "mvn dependency:tree" and
> the
> > "Dependency Hierarchy" view in Eclipse.  I'm not completely certain how
> to
> > interpret what I'm seeing.
> >
> > The first thing I want to know is what is the best way to do this sort of
> > thing.  I find it hard to believe pasting the entire contents of the bom
> > that I want into the parent pom was the right way to do it, but I
> couldn't
> > get it to work any other way, and now it's not working anyway.
> >
> > I can provide more details of specific poms and parent poms, but I wanted
> > to see if there was a simple solution first.
> >
> > I am basically aware of the difference between "dependencyManagement" and
> > "dependencies" in a parent pom.
> >
>
>

Re: How to properly override junit-platform and junit-jupiter in a parent pom

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

It's important to define the junit-bom import before the
spring-boot-dependencies import part in dependencyManagement which assumes
you don't use spring-boot-parent?

Kind regards
Karl Heinz Marbaise


On 16.06.22 23:54, David Karr wrote:
> We have a bunch of services running Spring Boot 2.3.12, which by default
> uses junit-platform 1.6.3 and junit-jupiter 5.6.3.
>
> We are trying to instead use junit-platform 1.8.2 and junit-jupiter 5.8.2.
> All the artifacts and versions we need are in junit-bom-5.8.2.
>
> We want to control this in our parent pom(s), as we have dozens of similar
> services all using the same parent pom.
>
> I thought I had this working, but now it appears it's not, and I'm not sure
> what I'm missing.
>
> At one time I had thought all I had to do was include junit-bom v5.8.2 in
> the "dependencies" list in the parent pom, but that never worked.  For lack
> of any other solution, I simply pasted the contents of the "dependencies"
> list from junit-bom-5.8.2 into the "dependencies" list of my parent pom.
> At one point, I thought this was working.
>
> Today, I'm looking at one service that uses that parent pom, but for some
> reason it's not getting the newer versions of the artifacts, it's still
> getting 1.6.3 and 5.6.3.  I'm looking at both "mvn dependency:tree" and the
> "Dependency Hierarchy" view in Eclipse.  I'm not completely certain how to
> interpret what I'm seeing.
>
> The first thing I want to know is what is the best way to do this sort of
> thing.  I find it hard to believe pasting the entire contents of the bom
> that I want into the parent pom was the right way to do it, but I couldn't
> get it to work any other way, and now it's not working anyway.
>
> I can provide more details of specific poms and parent poms, but I wanted
> to see if there was a simple solution first.
>
> I am basically aware of the difference between "dependencyManagement" and
> "dependencies" in a parent pom.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to properly override junit-platform and junit-jupiter in a parent pom

Posted by David Karr <da...@gmail.com>.
On Sat, Jun 18, 2022 at 4:17 PM Nils Breunese <ni...@breun.nl> wrote:

> David Karr <da...@gmail.com> wrote:
>
> > We have a bunch of services running Spring Boot 2.3.12, which by default
> > uses junit-platform 1.6.3 and junit-jupiter 5.6.3.
> >
> > We are trying to instead use junit-platform 1.8.2 and junit-jupiter
> 5.8.2.
> > All the artifacts and versions we need are in junit-bom-5.8.2.
> >
> > We want to control this in our parent pom(s), as we have dozens of
> similar
> > services all using the same parent pom.
>
> Spring Boot dependencies for version 2.3.12.RELEASE (
> https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.3.12.RELEASE/pom)
> sets the junit-jupiter.version property to 5.6.3, but you can override that
> property in your own project.
>
> I would consider upgrading to a more recent version of Spring Boot,
> because 2.3.x reached end of OSS support on May 20, 2021 (
> https://spring.io/projects/spring-boot#support). Spring Boot 2.7.0 (
> https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.7.0/pom)
> comes with JUnit Jupiter 5.8.2 by default.
>

Yup, I'm aware of all that.  We have a large number of services running our
internal platform.  It takes us a while to implement an upgrade.  We
started planning for it a couple of weeks ago, and it will take quite a
while to move everything.

Re: How to properly override junit-platform and junit-jupiter in a parent pom

Posted by Nils Breunese <ni...@breun.nl>.
David Karr <da...@gmail.com> wrote:

> We have a bunch of services running Spring Boot 2.3.12, which by default
> uses junit-platform 1.6.3 and junit-jupiter 5.6.3.
> 
> We are trying to instead use junit-platform 1.8.2 and junit-jupiter 5.8.2.
> All the artifacts and versions we need are in junit-bom-5.8.2.
> 
> We want to control this in our parent pom(s), as we have dozens of similar
> services all using the same parent pom.

Spring Boot dependencies for version 2.3.12.RELEASE (https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.3.12.RELEASE/pom) sets the junit-jupiter.version property to 5.6.3, but you can override that property in your own project.

I would consider upgrading to a more recent version of Spring Boot, because 2.3.x reached end of OSS support on May 20, 2021 (https://spring.io/projects/spring-boot#support). Spring Boot 2.7.0 (https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.7.0/pom) comes with JUnit Jupiter 5.8.2 by default.

Nils.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org