michael-o commented on PR #737: URL: https://github.com/apache/maven-surefire/pull/737#issuecomment-2140161031
> According to https://junit.org/junit5/docs/current/user-guide/#running-tests-build-maven "it is recommended to use the JUnit Platform BOM to align the versions of all JUnit 5 artifacts." Perhaps the Surefire ITs should follow this advice. > > Reading on [it says](https://junit.org/junit5/docs/current/user-guide/#running-tests-build-maven-engines-configure): > > > To configure support for JUnit Jupiter based tests, configure test scoped dependencies on the JUnit Jupiter API and the JUnit Jupiter TestEngine implementation similar to the following. > > ``` > <dependency> > <groupId>org.junit.jupiter</groupId> > <artifactId>junit-jupiter</artifactId> > <version>5.10.2</version> <!-- can be omitted when using the BOM --> > <scope>test</scope> > </dependency> > ``` Tried to following: ``` osipovmi@deblndw011x:~/var/Projekte/maven-surefire/surefire-its/src/test/resources/junit-4-5 (parent-42-maven-3.6.3 *=) $ git diff diff --git a/surefire-its/src/test/resources/junit-4-5/pom.xml b/surefire-its/src/test/resources/junit-4-5/pom.xml index 9a9d69c27..9dddede92 100644 --- a/surefire-its/src/test/resources/junit-4-5/pom.xml +++ b/surefire-its/src/test/resources/junit-4-5/pom.xml @@ -135,12 +135,26 @@ </build> </profile> <profile> - <id>select-junit5</id> + <id>select-junit5</id> + + +<dependencyManagement> + <dependencies> + <dependency> + <groupId>org.junit</groupId> + <artifactId>junit-bom</artifactId> + <version>5.9.1</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> +</dependencyManagement> + + <dependencies> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> - <version>5.9.1</version> <scope>test</scope> </dependency> <dependency> @@ -161,11 +175,6 @@ <artifactId>junit-jupiter-engine</artifactId> <version>5.9.1</version> </dependency> - <dependency> - <groupId>org.junit.platform</groupId> - <artifactId>junit-platform-engine</artifactId> - <version>1.9.1</version> - </dependency> </dependencies> </plugin> </plugins> ``` and I am back to ``` [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.2.6-SNAPSHOT:test (default-test) on project junit-4-5: [ERROR] [ERROR] Please refer to /var/osipovmi/Projekte/maven-surefire/surefire-its/src/test/resources/junit-4-5/target/surefire-reports for the individual test results. [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. [ERROR] There was an error in the forked process [ERROR] org.junit.platform.commons.util.ExceptionUtils.findNestedThrowables(Ljava/lang/Throwable;)Ljava/util/List; [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process [ERROR] org.junit.platform.commons.util.ExceptionUtils.findNestedThrowables(Ljava/lang/Throwable;)Ljava/util/List; [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:628) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:285) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:250) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1224) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1073) ``` because of the plugin classpath: ``` [DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-surefire-plugin:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.plugins:maven-surefire-plugin:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.junit.jupiter:junit-jupiter-engine:jar:5.9.1 [DEBUG] Included: org.junit.platform:junit-platform-engine:jar:1.10.2 [DEBUG] Included: org.opentest4j:opentest4j:jar:1.3.0 [DEBUG] Included: org.junit.platform:junit-platform-commons:jar:1.10.2 [DEBUG] Included: org.junit.jupiter:junit-jupiter-api:jar:5.10.2 [DEBUG] Included: org.apiguardian:apiguardian-api:jar:1.1.2 [DEBUG] Included: org.apache.maven.surefire:maven-surefire-common:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.surefire:surefire-api:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.surefire:surefire-logger-api:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.surefire:surefire-extensions-api:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.surefire:surefire-booter:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.surefire:surefire-extensions-spi:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.resolver:maven-resolver-util:jar:1.4.1 [DEBUG] Included: org.apache.maven.shared:maven-common-artifact-filters:jar:3.1.1 [DEBUG] Included: commons-io:commons-io:jar:2.16.1 [DEBUG] Included: org.codehaus.plexus:plexus-java:jar:1.2.0 [DEBUG] Included: org.ow2.asm:asm:jar:9.6 [DEBUG] Included: com.thoughtworks.qdox:qdox:jar:2.0.3 [DEBUG] Included: org.apache.maven.surefire:surefire-shared-utils:jar:3.2.6-SNAPSHOT ``` with the fix it is: ``` [DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-surefire-plugin:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.plugins:maven-surefire-plugin:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.junit.jupiter:junit-jupiter-engine:jar:5.9.1 [DEBUG] Included: org.junit.jupiter:junit-jupiter-api:jar:5.10.2 [DEBUG] Included: org.apiguardian:apiguardian-api:jar:1.1.2 [DEBUG] Included: org.junit.platform:junit-platform-engine:jar:1.9.1 [DEBUG] Included: org.opentest4j:opentest4j:jar:1.2.0 [DEBUG] Included: org.junit.platform:junit-platform-commons:jar:1.10.2 [DEBUG] Included: org.apache.maven.surefire:maven-surefire-common:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.surefire:surefire-api:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.surefire:surefire-logger-api:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.surefire:surefire-extensions-api:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.surefire:surefire-booter:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.surefire:surefire-extensions-spi:jar:3.2.6-SNAPSHOT [DEBUG] Included: org.apache.maven.resolver:maven-resolver-util:jar:1.4.1 [DEBUG] Included: org.apache.maven.shared:maven-common-artifact-filters:jar:3.1.1 [DEBUG] Included: commons-io:commons-io:jar:2.16.1 [DEBUG] Included: org.codehaus.plexus:plexus-java:jar:1.2.0 [DEBUG] Included: org.ow2.asm:asm:jar:9.6 [DEBUG] Included: com.thoughtworks.qdox:qdox:jar:2.0.3 [DEBUG] Included: org.apache.maven.surefire:surefire-shared-utils:jar:3.2.6-SNAPSHOT ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org