jhipster-lite icon indicating copy to clipboard operation
jhipster-lite copied to clipboard

testcontainers: exclude junit

Open pascalgrimaud opened this issue 1 year ago • 2 comments

When there is testcontainers dependency, there are 2 junit dependencies. The results in IDE are:

image

To avoid this, we should exclude junit:

    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>postgresql</artifactId>
      <version>${testcontainers.version}</version>
      <exclusions>
        <exclusion>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
        </exclusion>
      </exclusions>
      <scope>test</scope>
    </dependency>

pascalgrimaud avatar Aug 04 '23 07:08 pascalgrimaud

I stumbled upon this issue a few days ago, but it's not as simple as excluding the dependency. See https://github.com/testcontainers/testcontainers-java/issues/970 There's still a runtime dependency required by testcontainers. A workaround is to recreate fake junit4 rules: https://github.com/spring-projects-experimental/spring-boot-migrator/pull/777/files#diff-f3362ff9066efd77e7727c970892542c62437c2340439773fde412786623bbd4

murdos avatar Aug 04 '23 09:08 murdos

Oh nice catch @murdos In my project, I don't use GenericContainer so that's why I'm fine, and for existing modules, there is no use of it

pascalgrimaud avatar Aug 04 '23 09:08 pascalgrimaud

Let's close this, as it's not so important to fix it, and it will be fixed automatically one day, I think :)

pascalgrimaud avatar Mar 15 '24 10:03 pascalgrimaud