Reputation: 339
I ended up manually adding a java file "CreateGroovyScripts", to a local repo I had because the remote repo was not available. When I run it as a Junit, it gives me the following error:
Is there anything else I need to do with the project? It is a maven project and the only thing I have tried was to "Update Project" in the Maven sub-menu when I right click the project.
NOTE: The file was added using "New -> File" and then I simply named it CreateGroovyFiles.java and copy and pasted the code from a separate repo
Upvotes: 0
Views: 163
Reputation: 1593
I believe that, when you run it as Junit , it does not work because the recently added class (i.e CreateGroovyFiles) is not in Eclipse project's classpath, and that might explain the ClassNotFoundException you get.
You can check whether it is in your build path or not by searching after it: Type Ctrl+Shift+T and search after CreateGroovyFiles. If it does not find anything that means that the class is not in the classpath.
In order to add it into the classpath you need to mark the folder containg all the depicted packages as a source folder.
Upvotes: 2