Fix test dependencies with junit5/kotlin/junit4 combination

When using kotlin test, which brings in the JUnit5 platform,
additionally the junit-vintage-engine needs to be added to
the test classpath, so that surefire will execute all tests
(junit5/kotlin test + junit4 tests).
This commit is contained in:
Andreas Dangel 2019-03-10 19:32:20 +01:00
parent 6b50437df3
commit 002ecb7783
4 changed files with 67 additions and 45 deletions

View File

@ -128,7 +128,6 @@
</dependency>
<!-- TEST DEPENDENCIES -->
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-lang-test</artifactId>
@ -149,6 +148,12 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>

View File

@ -43,42 +43,43 @@
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
</dependency>
<!--
the following dependencies are all scope compile,
so that they are automatically available to users
of the pmd-lang-test module
-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.kotlintest</groupId>
<artifactId>kotlintest-runner-junit5</artifactId>
<version>3.1.8</version>
<scope>compile</scope>
</dependency>
@ -86,7 +87,7 @@
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>6.9.0</version>
<version>6.12.0</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -15,6 +15,8 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<!-- overrides the default scope from inherited dependency management. -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>

80
pom.xml
View File

@ -432,17 +432,7 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code
<configuration>
<forkMode>once</forkMode>
<runOrder>alphabetical</runOrder>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
</configuration>
<dependencies>
<!-- Junit 3 & 4 engine -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.4.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@ -816,11 +806,6 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code
<artifactId>pmd-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-test</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.saxon</groupId>
<artifactId>saxon</artifactId>
@ -837,21 +822,6 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code
<artifactId>rhino</artifactId>
<version>1.7.7.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>net.java.dev.javacc</groupId>
<artifactId>javacc</artifactId>
@ -905,7 +875,12 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code
</dependency>
<!-- TEST DEPENDENCIES -->
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-test</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
@ -914,8 +889,48 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code
<scope>test</scope>
</dependency>
<!-- Kotlin -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.1.1</version>
<scope>test</scope>
</dependency>
<!-- Junit 5 Engine -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<!-- Junit 3 & 4 engine -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<!-- Kotlin -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
@ -943,7 +958,6 @@ Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code
<version>3.1.8</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>