Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix junit dependency for java cucumber project #236

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

itbhp
Copy link
Contributor

@itbhp itbhp commented Oct 12, 2023

I was trying out the java/cucumber project and it was not working

 mvn verify                                                                                                                  21:51  itbhp@gallifrey
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< swkBerlin:cucumber-jvm-junit5 >--------------------
[INFO] Building cucumber-jvm-junit5 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ cucumber-jvm-junit5 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/itbhp/Documents/Projects/github/itbhp/katas/kata-bootstraps/java/cucumber/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.10.0:compile (default-compile) @ cucumber-jvm-junit5 ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ cucumber-jvm-junit5 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.10.0:testCompile (default-testCompile) @ cucumber-jvm-junit5 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ cucumber-jvm-junit5 ---
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ cucumber-jvm-junit5 ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /Users/itbhp/Documents/Projects/github/itbhp/katas/kata-bootstraps/java/cucumber/target/cucumber-jvm-junit5-1.0.0.jar
[INFO] 
[INFO] --- maven-antrun-plugin:1.8:run (CLI-test) @ cucumber-jvm-junit5 ---
[INFO] Executing tasks

main:
     [echo] Running JUnit Platform CLI
     [java] 
     [java] Thanks for using JUnit! Support its development at https://junit.org/sponsoring
     [java] 
     [java] Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/platform/commons/util/ClassNamePatternFilterUtils
     [java]     at org.junit.platform.launcher.core.LauncherFactory.loadAndFilterTestExecutionListeners(LauncherFactory.java:191)
     [java]     at org.junit.platform.launcher.core.LauncherFactory.registerTestExecutionListeners(LauncherFactory.java:179)
     [java]     at org.junit.platform.launcher.core.LauncherFactory.createDefaultLauncher(LauncherFactory.java:137)
     [java]     at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:125)
     [java]     at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:109)
     [java]     at org.junit.platform.console.tasks.ConsoleTestExecutor.executeTests(ConsoleTestExecutor.java:62)
     [java]     at org.junit.platform.console.tasks.ConsoleTestExecutor.lambda$execute$0(ConsoleTestExecutor.java:58)
     [java]     at org.junit.platform.console.tasks.CustomContextClassLoaderExecutor.invoke(CustomContextClassLoaderExecutor.java:33)
     [java]     at org.junit.platform.console.tasks.ConsoleTestExecutor.execute(ConsoleTestExecutor.java:58)
     [java]     at org.junit.platform.console.ConsoleLauncher.executeTests(ConsoleLauncher.java:95)
     [java]     at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:73)
     [java]     at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:50)
     [java]     at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:43)
     [java]     at org.junit.platform.console.ConsoleLauncher.main(ConsoleLauncher.java:37)
     [java] Caused by: java.lang.ClassNotFoundException: org.junit.platform.commons.util.ClassNamePatternFilterUtils
     [java]     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
     [java]     at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
     [java]     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
     [java]     ... 14 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.151 s
[INFO] Finished at: 2023-10-12T21:51:50+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (CLI-test) on project cucumber-jvm-junit5: An Ant BuildException has occured: Java returned: 1
[ERROR] around Ant part ...<java newenvironment="true" fork="true" classname="org.junit.platform.console.ConsoleLauncher" maxmemory="512m" failonerror="true" classpathref="maven.test.classpath">... @ 5:170 in /Users/itbhp/Documents/Projects/github/itbhp/katas/kata-bootstraps/java/cucumber/target/antrun/build-main.xml

I was using this Java version

$ java --version                                                                                                             
openjdk 17.0.5 2022-10-18 LTS
OpenJDK Runtime Environment Corretto-17.0.5.8.1 (build 17.0.5+8-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.5.8.1 (build 17.0.5+8-LTS, mixed mode, sharing)

and this maven version

$ mvn -version                                                                                                              
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/itbhp/.sdkman/candidates/maven/current
Java version: 17.0.5, vendor: Amazon.com Inc., runtime: /Users/itbhp/.sdkman/candidates/java/17.0.5-amzn
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "13.5.2", arch: "x86_64", family: "mac"

@itbhp itbhp force-pushed the fix-cucumber-java branch from dc0891d to d3f8004 Compare October 12, 2023 20:00
@itbhp itbhp force-pushed the fix-cucumber-java branch from d3f8004 to 67ba287 Compare October 12, 2023 20:02
@mklose
Copy link
Member

mklose commented Oct 18, 2023

Thank you @itbhp for contributing ❤️

@mklose mklose merged commit a7479d8 into swkBerlin:master Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants