When I have a mixed Groovy/Java project in netbeans, my Java classes are unable to import groovy classes in the same project. It shows them as errors in the import list. But when I run the build everything compiles and the code works.
steps to reproduce:
- Create a single gradle project.
- Update build.gradle by adding `apply plugin: 'groovy'`
- Update build.gradle adding `compile 'org.codehaus.groovy:groovy:3.0.0-alpha-3'`
- Run clean/build
- Create `groovy` folder in the src/main/ directory
- Move Main java class into src/main/groovy (this way the groovy plugin will compile and run everything together without problem.)
- reload project so groovy shows up in the Projects view.
- Create a groovy class next to the Main java class.
- Create a simple method in groovy class.
- in the java class, instantiate the groovy class and run the method from it.
At this point the Java class file will display the error `Cannot find symbol`. But if one runs the program it will compile and work just fine.
The intended functionality works in other IDE, including NetBeans 8.2, however in 9 there is this problem.
The attachments display the build.gradle file, the groovy and java class (java contains the errors) and a shot of the project structure.