Reputation: 1698
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.
Upvotes: 4
Views: 3986
Reputation: 41
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.
Upvotes: 2
Reputation: 64012
You could have done just with single step "Import as a gradle project" in newer Eclipse IDE instance.
Upvotes: 0
Reputation: 1698
I was able to solve this doing the following steps.
gradle cleanEclipse eclipse
At that point, everything was set up again.
Upvotes: 5