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

Consider including test dependency versions in Micronaut BOM #2298

Closed
marceloverdijk opened this issue Nov 5, 2019 · 4 comments · Fixed by micronaut-projects/micronaut-test#186
Assignees

Comments

@marceloverdijk
Copy link
Contributor

Currently adding kotlintest to a project looks like:

    testImplementation(platform("io.micronaut:micronaut-bom:$micronautVersion"))
    testImplementation("io.kotlintest:kotlintest-runner-junit5:3.3.2")
    testImplementation("io.micronaut.test:micronaut-test-junit5")
    testImplementation("io.micronaut.test:micronaut-test-kotlintest")
    testImplementation("io.mockk:mockk:1.9.3")
    testImplementation("org.junit.jupiter:junit-jupiter-api")

It would be nice if the kotlintest-runner-junit5 and mockk``versions could be derived automatically from the Micronaut BOM like junit-jupiter-api`.

The same counts when using e.g. Spock or Mockito.

@jameskleeh
Copy link
Contributor

So I don't think we should be pinning the version of mockk or mockito because we don't have any code that relies any given version. You can use those mocking libraries or anything else.

@marceloverdijk
Copy link
Contributor Author

Although I don't mind specifying the versions myself it could benefit users to be honest.

Just like micronaut-test-junit5 already includes the junit5 version, it feels a bit cumbersome to have to specify the version for the io.kotlintest:kotlintest-runner-junit5:3.3.2...

I mean with both:

testImplementation("io.micronaut.test:micronaut-test-junit5")
testImplementation("io.micronaut.test:micronaut-test-kotlintest")

it's clearly I also will need the kotlintest-runner-junit5.

@jameskleeh
Copy link
Contributor

Yeah I specifically didn't mention the junit kotlintest runner and left this issue open because I'm not sure if that makes sense or not. To me the whole point of the BOM is to define dependency versions that are known to work together. If only specific versions of the junit runner work with specific versions of kotlintest then I think we should add it.

@ctoestreich
Copy link
Contributor

ctoestreich commented Nov 6, 2019

@jameskleeh To me the whole point of the BOM is to define dependency versions that are known to work together - Yes, but to elaborate, by not including versions of things it is like saying "No idea what version to use, you pick".

Our team moved away from that a long time ago, and as many previous issues I have submitted about maven enforcer issues, we make sure the transitive deps are pinned as well to MAKE sure our stuff works and lib versions are explicit NOT implicit.

Micronaut use gradle and I am not sure if there is a similar plugin to https://maven.apache.org/enforcer/maven-enforcer-plugin/ for gradle.

In our team BOMs we require and enforce transitive pinning. We have all our libs and the deps that conflict in versions included in the depMgmt sections.

It would be the right answer to put anything with io.micronaut.* package into the base BOM. As to the above library io.kotlintest:kotlintest-runner-junit5:3.3.2, if it isn't used by micronaut libs, then do not include these as a convenience. @marceloverdijk If you are pulling in a helper lib that is not part of the core framework, then I suggest you roll your own BOM around micronaut BOM that does this for you. That is the pattern we use.

Our bom is also called micronaut-bom and has our internal group id and looks like this (just a snippet). I have included the fact that we have to add a bunch of pinned versions (like netty) due to micronaut bom using "lazy" (aka transitive) version resolution and many libraries across micronaut ask for different versions of netty libs which will fail compilation due to the enforcer plugin (which we want) so that we can make sure transitives are all using the same (and usually latest) versions of libs.

<groupId>com.xxxxxx.xxxxxxx</groupId>
<artifactId>micronaut-bom</artifactId>
    <packaging>pom</packaging>

    <name>Micronaut BOM</name>
    <description>Micronaut dependency management Bill of Materials</description>

    <properties>
        <flatten.mode>bom</flatten.mode>
        <maven.deploy.skip>false</maven.deploy.skip>
        <maven.usage.skip>false</maven.usage.skip>
        <asm.version>6.2</asm.version>
        <commons-dbcp2.version>2.6.0</commons-dbcp2.version>
        <dropwizard-metrics.version>4.0.5</dropwizard-metrics.version>
        <groovy.version>2.5.4</groovy.version>
        <jackson.version>2.9.9</jackson.version>
        <kafka.version>2.3.0</kafka.version>
        <lombok.version>1.18.8</lombok.version>
        <micrometer.version>1.2.2</micrometer.version>
        <micronaut.version>1.2.5</micronaut.version>
        <micronaut.test.version>1.1.1</micronaut.test.version>
        <netty.version>4.1.43.Final</netty.version>
        <spock.version>1.2-groovy-2.5</spock.version>
        <spring.version>5.1.10.RELEASE</spring.version>
        <spring-beans.version>${spring.version}</spring-beans.version>
    </properties>
<dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-framework-bom</artifactId>
                <version>${spring.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- INTERNAL LIB BOM -->
            <dependency>
                <groupId>com.xxxxxxxx.xxxxxx.framework</groupId>
                <artifactId>lib-bom</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- MICRONAUT BOM -->
            <dependency>
                <groupId>io.micronaut</groupId>
                <artifactId>micronaut-bom</artifactId>
                <version>${micronaut.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Jackson BOM -->
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

            <!-- CONVENIENCE DEPENDENCIES -->
            <dependency>
                <groupId>org.reactivestreams</groupId>
                <artifactId>reactive-streams</artifactId>
                <version>1.0.2</version>
            </dependency>

            <!-- netty -->
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-buffer</artifactId>
                <version>${netty.version}</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-codec</artifactId>
                <version>${netty.version}</version>
            </dependency>
     ....

  ....etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants