Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Obvious Fix) Add dependency management for JUnit Jupiter Aggregator #16330

Closed
wants to merge 1 commit into from
Closed

(Obvious Fix) Add dependency management for JUnit Jupiter Aggregator #16330

wants to merge 1 commit into from

Conversation

radistao
Copy link

@radistao radistao commented Mar 26, 2019

Obvious Fix

Enhancement

Additionally to JUnit Bom starting from version 5.4.0 the project provides JUnit Jupiter (Aggregator) dependency, which simplifies dependency management for common cases, e.g. when one needs only api+engine+params, which seems to be the most common case. Gradle example:

  • now:
    dependencies {
         testImplementation 'org.junit.jupiter:junit-jupiter-api'
         testImplementation 'org.junit.jupiter:junit-jupiter-params'
         testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
    }
    
  • after enhancement:
    dependencies {
        testImplementation 'org.junit.jupiter:junit-jupiter'
    }
    

Note: in the PR for new added org.junit.jupiter:junit-jupiter dependency I reused the same ${junit-jupiter.version} as for org.junit:junit-bom

More detailed information:

  - in addition to Junit BOM this aggregator allows to add one-line
  dependency for Jupiter `api`, `engine` and `params`.
  See https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter
  and
  https://github.com/junit-team/junit5/commits/master/junit-jupiter/junit-jupiter.gradle.kts
  for details.
@pivotal-issuemaster
Copy link

@radistao Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 26, 2019
@pivotal-issuemaster
Copy link

@radistao This Pull Request contains an obvious fix. Signing the Contributor License Agreement is not necessary.

@radistao radistao changed the title Add dependency management for JUnit Jupiter Aggregator (Obvious Fix) Add dependency management for JUnit Jupiter Aggregator Mar 26, 2019
@snicoll
Copy link
Member

snicoll commented Mar 27, 2019

@radistao junit-jupiter is already provided by the BOM so there is no need to add it.

@snicoll snicoll closed this Mar 27, 2019
@snicoll snicoll added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 27, 2019
@radistao
Copy link
Author

radistao commented Mar 27, 2019

junit-jupiter is already provided by the BOM so there is no need to add it.

@snicoll that's exactly what i wrote in the beginning of the PR description:

Additionally to JUnit Bom

But the idea of this dependency is different: avoid dependencies "clogging" where it's possible. Obviously in almost all cases Jupiter is used with both api and engine, and in most cases with params. That's why JUnit developers introduces this aggregated dependency.

As an example from existent Spring-boot dependencies:

  • spring-boot-starter aggregates spring-boot-autoconfigure, spring-boot-starter-logging, snakeyaml etc, which already inherited by the BOM. But instead of including all these dependencies one-by-one and duplicating a lot of code:
    dependencies {
        implementation 'org.springframework.boot:spring-boot'
        implementation 'org.springframework.boot:spring-boot-autoconfigure'
        implementation 'org.springframework.boot:spring-boot-starter-logging'
        implementation 'javax.annotation:javax.annotation-api'
        implementation 'org.springframework:spring-core'
        runtime 'org.yaml:runtime'
    }
    
    developers may simply use aggregated dependency:
    dependencies {
        implementation 'org.springframework.boot:spring-boot-starter'
    }
    

If Spring-boot uses such approach, why JUnit can't be used in such a way?

@snicoll
Copy link
Member

snicoll commented Mar 27, 2019

I know what the dependency is, we’ve actually asked for that feature.

What do you think your change does exactly? Looking at the diff it is redundant to what the bom import does. Perhaps we can take a step back and you can describe the problem you’re trying to fix and how that change helps.

@radistao
Copy link
Author

ah, i see now, my bad:
i was confused by versions, because i used spring boot 2.1.3.RELEASE, which includes JUnit bom 5.3.2, which didn't have junit-jupiter.

But current spring-boot 2.2.0.M1 upgraded JUnit to 5.4.0, and now it contains respective junit-jupiter artifact.

So yeah, sorry for disturbing - i mixed up the versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants