Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-783

The "junit:junit" dependency is in productized "io.quarkus:quarkus-bom", remove it

XMLWordPrintable

    • Hide

      The workaround is to explictly change the junit scope:

              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <scope>compile</scope>
              </dependency>
      
      Show
      The workaround is to explictly change the junit scope: <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>compile</scope> </dependency>
    • Undefined
    • +
    • ---

      The "junit:junit" dependency is defined in productized "io.quarkus:quarkus-bom" as:

                  <dependency>
                      <groupId>junit</groupId>
                      <artifactId>junit</artifactId>
                      <type>jar</type>
                      <version>4.12</version>
                      <scope>test</scope>
                  </dependency>
      

      The "quarkus-bom" dependency in upstream is not defining the junit4 dependency.

      The product version of "quarkus-bom" should not do this either.

      The problem is that if we use a "junit" dependant dependency like "testcontainers" with a scope different than "test":

              <dependency>
                  <groupId>org.testcontainers</groupId>
                  <artifactId>testcontainers</artifactId>
                  <scope>compile</scope>
              </dependency>
      

      It will fail with:

      java.lang.NoClassDefFoundError: org/junit/rules/TestRule
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      ...
      

      This is caused because "quarkus-bom" is setting the "junit" dependency with scope "test".

      The "quarkus-bom" dependency in upstream is not using the "junit" dependency. The product version of "quarkus-bom" should not do this either.

      Note that this is not a regression issue entered in 1.11.0.ER1, but it's also happening in previous releases.

            hamadhan@redhat.com Harsh Madhani
            jcarvaja@redhat.com Jose Carvajal Hilario
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: