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

testcontainers: exclude junit #7101

Closed
pascalgrimaud opened this issue Aug 4, 2023 · 3 comments
Closed

testcontainers: exclude junit #7101

pascalgrimaud opened this issue Aug 4, 2023 · 3 comments

Comments

@pascalgrimaud
Copy link
Member

pascalgrimaud commented Aug 4, 2023

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>
@murdos
Copy link
Contributor

murdos commented Aug 4, 2023

I stumbled upon this issue a few days ago, but it's not as simple as excluding the dependency.
See testcontainers/testcontainers-java#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

@pascalgrimaud
Copy link
Member Author

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
Copy link
Member Author

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

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

No branches or pull requests

3 participants
@murdos @pascalgrimaud and others