Maven Surefire

junit-dep 4.4+ isn't detected - transitive dependency to JUnit-3.x causes POJO-test treatment

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.4.3
  • Fix Version/s: 2.7.2
  • Component/s: Junit 4.x support
  • Labels:
    None
  • Environment:
    $ mvn --version
    Maven version: 2.0.9
    Java version: 1.6.0_07
    OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
  • Complexity:
    Intermediate
  • Testcase included:
    yes
  • Number of attachments :
    2

Description

Have a dependency to junit-dep version 4.4 or later and a transitive or optional dependency to junit-3.8.1 and suddenly the fix for SUREFIRE-378 has been deceived. Your JUnit4 tests will again be executed as if they were POJO-tests.

The attached maven-project reveals the bug.

Issue Links

Activity

Hide
Henrik Kaipe added a comment -

The uploaded patch "surefire519-fix-and-test.patch" fixes the issue by specifying "junit:junit-dep" as the default JUnit artifact.
Backward compatibility is preserved by having the SUREFIRE-378 fix reversed. I.e. check for the alternate artifact name "junit:junit" in case the default was not found ...

Show
Henrik Kaipe added a comment - The uploaded patch "surefire519-fix-and-test.patch" fixes the issue by specifying "junit:junit-dep" as the default JUnit artifact. Backward compatibility is preserved by having the SUREFIRE-378 fix reversed. I.e. check for the alternate artifact name "junit:junit" in case the default was not found ...
Hide
Antony Stubbs added a comment -

Fascinating. I just bumped into this issue as well. Looks like there's a unit test missing from the junit test suite eh? This is definitely a regression.

Is there a work around for this? For now, I'll switch back to junit (with out the -dep )

Show
Antony Stubbs added a comment - Fascinating. I just bumped into this issue as well. Looks like there's a unit test missing from the junit test suite eh? This is definitely a regression. Is there a work around for this? For now, I'll switch back to junit (with out the -dep )
Hide
Henrik Kaipe added a comment - - edited

There is a "simple" workaround. In your pom.xml you can specify "junitArtifactName" for the surefire-plugin:

...
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>

<!--
This piece of configuration is a workaround for this bug:
http://jira.codehaus.org/browse/SUREFIRE-519
-->
<junitArtifactName>junit:junit-dep</junitArtifactName>
</configuration>
</plugin>
...

Show
Henrik Kaipe added a comment - - edited There is a "simple" workaround. In your pom.xml you can specify "junitArtifactName" for the surefire-plugin: ... <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <!-- This piece of configuration is a workaround for this bug: http://jira.codehaus.org/browse/SUREFIRE-519 --> <junitArtifactName>junit:junit-dep</junitArtifactName> </configuration> </plugin> ...
Hide
Kristian Rosenvold added a comment -

Fixed with testcase update in r1054768

Show
Kristian Rosenvold added a comment - Fixed with testcase update in r1054768

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: