JUnit 5 console launcher does not find tests inside JAR

Solution 1:

After cloning your repo and adding a repo to the build file, the following worked for me:

gradle wrapper
./gradlew shadowJar
java -cp ./build/libs/junit-console-launcher-shaded-jar-all.jar org.junit.platform.console.ConsoleLauncher --scan-classpath ./build/libs/junit-console-launcher-shaded-jar-all.jar

Output:

╷
└─ JUnit Jupiter ✔
   └─ ExampleTest ✔
      └─ test() ✔

Test run finished after 50 ms
[         2 containers found      ]
[         0 containers skipped    ]
[         2 containers started    ]
[         0 containers aborted    ]
[         2 containers successful ]
[         0 containers failed     ]
[         1 tests found           ]
[         0 tests skipped         ]
[         1 tests started         ]
[         0 tests aborted         ]
[         1 tests successful      ]
[         0 tests failed          ]

Using -jar option does not work, probably because the manifest is not correctly set in the shadow jar.