Haven't tried with 1.7.4 (yet), but the duplicate-finder-maven-plugin complains of the following when running a duplicate finder check on my test classpath:
[INFO] Checking test classpath
[WARNING] Found duplicate (but equal) classes in [org.powermock:powermock-api-mockito-common:1.7.3, org.powermock:powermock-api-mockito2:1.7.3]:
[WARNING] org.powermock.api.mockito.expectation.WithExpectedArguments
[WARNING] org.powermock.api.mockito.expectation.WithoutExpectedArguments
[WARNING] Found duplicate classes/resources in test classpath.
The relevant entries from my pom are as follows:
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>1.7.3</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.7.3</version>
</dependency>
Sure enough, it looks like both powermock-api-mockito2:jar:1.7.3 and one of its direct dependencies powermock-api-mockito-common:jar:1.7.3 contains the same .class files for the following:
org.powermock.api.mockito.expectation.WithExpectedArgumentsorg.powermock.api.mockito.expectation.WithoutExpectedArguments[root@bb6939b2801f ~]# jar tvf .m2/repository/org/powermock/powermock-api-mockito2/1.7.3/powermock-api-mockito2-1.7.3.jar | grep -i with
403 Sat Sep 16 17:39:16 UTC 2017 org/powermock/api/mockito/expectation/WithoutExpectedArguments.class
469 Sat Sep 16 17:39:16 UTC 2017 org/powermock/api/mockito/expectation/WithExpectedArguments.class
[root@bb6939b2801f ~]# jar tvf .m2/repository/org/powermock/powermock-api-mockito-common/1.7.3/powermock-api-mockito-common-1.7.3.jar | grep -i with
403 Sat Sep 16 17:39:08 UTC 2017 org/powermock/api/mockito/expectation/WithoutExpectedArguments.class
469 Sat Sep 16 17:39:08 UTC 2017 org/powermock/api/mockito/expectation/WithExpectedArguments.class
It is expected that both powermock-api-mockito2:jar:1.7.3 and powermock-api-mockito-common:jar:1.7.3 contain duplicate+identical copies of these .class files?
Maven duplicate-finder-maven-plugin workaround:
<ignoredClassPatterns>
<ignoredClassPattern>org\.powermock\.api\.mockito\.expectation\.With(out)?ExpectedArguments</ignoredClassPattern>
</ignoredClassPatterns>
Seems to crash my test builds for android tests.
Program type already present: org.powermock.api.mockito.expectation.WithoutExpectedArguments
Message{kind=ERROR, text=Program type already present: org.powermock.api.mockito.expectation.WithoutExpectedArguments, sources=[Unknown source file], tool name=Optional.of(D8)}
For 1.7.4
This is still happening. Are the duplicated classes addressed? Thanks.
@peterbetos it's definitely still an issue in 1.7.3 and 1.7.4. However, I haven't tried with the latest release, which as of this writing appears to be 2.0.0-RC.1:
https://github.com/powermock/powermock/releases/tag/powermock-2.0.0-RC.1
I have met the same problem, do you fix it?
Most helpful comment
Seems to crash my test builds for android tests.
For 1.7.4