Skip to content
New issue

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

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

Already on GitHub? # to your account

jersey-media-multipart depends on JUnit - regression #5226

Closed
benken-parasoft opened this issue Dec 29, 2022 · 1 comment · Fixed by #5229
Closed

jersey-media-multipart depends on JUnit - regression #5226

benken-parasoft opened this issue Dec 29, 2022 · 1 comment · Fixed by #5229
Milestone

Comments

@benken-parasoft
Copy link

After upgrading from Jersey 2.37 to 2.38, my project's main sources started building against JUnit Jupiter which is now getting pulled in as a transitive dependency of jersey-media-multipart. The JUnit dependency in the pom for jersey-media-multipart is missing <scope>test</scope>.

The pom for jersey-media-multipart 2.38 has this:

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
        </dependency>

The pom for jersey-media-multipart 2.37 is also missing test scope:

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>

Even though "test" scope is missing in 2.37, this problem was not visible in 2.37 because dependencyManagement for org.glassfish.jersey:project forced test scope:

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13.1</version>
                <scope>test</scope>
            </dependency>

In 2.38, dependencyManagement for org.glassfish.jersey:project now imports the JUnit BOM (which is good):

            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit5.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

So, now that the JUnit BOM is imported, any projects missing "test" scope for junit-jupiter need to be corrected. I noticed this for jersey-media-multipart but didn't check if any other Jersey modules also have the same issue.

As a workaround, I have to force an exclusion in my project's pom:

        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-multipart</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.jupiter</groupId>
                    <artifactId>junit-jupiter</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
benken-parasoft added a commit to parasoft/parabank that referenced this issue Dec 29, 2022
@cmuchinsky
Copy link

cmuchinsky commented Dec 30, 2022

A quick grep thru the Jersey source code, and it appears jersey-media-multipart is the only module missing the test scope.

@senivam senivam linked a pull request Jan 2, 2023 that will close this issue
@senivam senivam added this to the 2.39 milestone Jan 6, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants