Jakub Bochenski created MDEP-977:
------------------------------------

             Summary: Incorrect handling if transitive compile dependency is 
used in tests
                 Key: MDEP-977
                 URL: https://issues.apache.org/jira/browse/MDEP-977
             Project: Maven Dependency Plugin
          Issue Type: Bug
          Components: analyze-only
    Affects Versions: 3.8.1
            Reporter: Jakub Bochenski


PostgreSQLContainer extends GenericContainer which is a 
FailureDetectingExernalResource which then implements org.junit.rules.TestRule.

I think the case when you use Testcontainers in your main sources, while also 
have JUnit tests in your test sources is not handled correctly:

If you declare in pom.xml
```
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
        </dependency>
```
 then the analyze will fail with:

```
[INFO] --- dependency:3.8.1:analyze-only (analyze-only) @ persistence-test ---
[ERROR] Non-test scoped test only dependencies found:
[ERROR]    junit:junit:jar:4.13.2:compile
```

This is wrong - Junit needs to be in compile scope because of the 
Testcontainers classes extending it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to