I was using Maven to manage my project in Eclipse, but decided that Gradle looked like something that could end up benefiting me more. I'm trying to implement a CI/CD pipeline, but want to check certain thing (unit test success, and code coverage for example). After converting my project using
gradle eclipse
I find that I am no longer able to run JUnit test cases via the context menu
Right Click -> Run As... -> JUnit Test
With the following error
Class not found <package>.<class>
But when I run
gradle test
All of them pass, but don't give me any more information (which were run, which ones failed, which ones errored out).
By switching to a Gradle project, can all tasks only be run in the context of Gradle now? There are no errors reported in Eclipse, and building works fine. I have verified that the files are in the expected locations.
I was able to solve this doing the following steps.
gradle cleanEclipse eclipse
At that point, everything was set up again.
This was happening to me as well. I was comparing Gradle to Maven, and I couldn't right mouse click on my Test.java file and Run as JUnit Test. My project had originally started as a Maven project, and I had converted it to Gradle. The problem was due to the old JUnit Run Configurations. All I did was go into Run Configurations and delete all the ones for JUnit. After I did this it started working. Hope this helps as the gradle eclipseClean eclipse didn't work for me.
您可以在较新的Eclipse IDE实例中单步执行“作为gradle项目导入”。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.