Skip to content

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

@benken-parasoft

Description

@benken-parasoft

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions