Comments (2)
Thank you @howlger for your detailed analyses.
As mentioned, when the junit-platform-launcher
is missing on the launch configuration classpath, Eclipse adds its internal junit-platform-launcher, which may be not compatible with the used junit-jupiter
version:
With Maven this is no problem, because m2e adds the missing JUnit launcher with a matching version:
The clean way to solve this problem with Gradle/Buildship is to include the missing org.junit.platform:junit-platform-launcher
dependency in build.gradle
(see Manually declaring dependencies). This is automatically done when you create a project with the Gradle Build Init Plugin from newer Gradle distributions:
dependencies {
// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
[...]
Unfortunately, when you do not change the Gradle version in Window > Preferences > Gradle the New Gradle Project Wizard in Buildship uses Gradle 8.1.1 and the Build Init Plugin from this distribution does not add this dependency. In my opinion, this gives not the best first-time user experience.
The execution of JUnit tests on command line or with Run As > Gradle Test is no problem, because then the missing dependency is added at runtime. But this feature is deprecated and will be removed:
> Task :lib:test
The automatic loading of test framework implementation dependencies has been deprecated. This is scheduled to be removed in Gradle 9.0. Declare the desired test framework directly on the test suite or explicitly declare the test framework implementation dependencies on the test's runtime classpath. Consult the upgrading guide for further information: https://docs.gradle.org/8.3/userguide/upgrading_version_8.html#test_framework_implementation_dependencies
To improve the first-time user experience in Eclipse, Buildship should be updated to reference a newer Gradle distribution.
from buildship.
En mi caso particular este error se soluciono siguiendo estos pasos: Una vez abierto el proyecto, haz clic derecho sobre él y elige Properties -> Java Build Path. Activa la pestaña Libraries y haz clic sobre Add Library… Selecciona JUnit -> Next -> Finish -> Apply and close
Recuerda que también puedes añadir la librería a través de Maven, pero yo he añadido la librería de esta forma, que es igual de válida.
Observa que se han añadido todas las librerías correspondientes a JUnit 5 a tu proyecto.
tomado de: https://developrogramming.com/testear-con-junit-5/
from buildship.
Related Issues (20)
- Use preferences to decide if tabs or spaces are used in build script editor
- [Mac] After update on Eclipse version 09.2023 Splash Screen upside down HOT 2
- Kotlin Language server does not work on Windows
- The 3.1.8 release does not exist but a new release is needed for SimRel HOT 1
- Please ship org.gradle.toolingapi source jar in p2 repo
- An internal error occurred during: "Install semantic highlighting". HOT 1
- Problems building java17 projects with Buildship 3.1.8 and Eclipse 202312 HOT 5
- Importing java-library builds via "Projects from Folder or Archive" does not work correctly
- Marker Property value is too long
- Gradle tasks fail to load upon Eclipse start, manual refresh works as expected HOT 2
- 'files' dependencies should be added to the module path when applicable
- Improve Eclipse refresh time
- Finish button grayed out when importing a Gradle Project using Java 1.8,0_401
- Caused by: BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66 HOT 6
- Importing https://github.com/open-telemetry/opentelemetry-java doesn't create Eclipse projects
- Setup a chatroom in chat.eclipse.org for the community HOT 2
- The "Refresh Gradle Project" command does not reload .settings/org.eclipse.jdt.apt.core.prefs HOT 1
- Redistributing org.gradle.toolingapi HOT 2
- Eclipse buildship <-> BSP Integration : Delegate to BSP to execute tasks HOT 2
- Using compileOnly for dependency still makes it part of launch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buildship.