by generating stubs for the groovy files it is possible to let the java files compile without using the real groovy files, but java files, that are equal enough to produce compatible bytecode. the Groovy compiler will then compile the .groovy files, which overwrites the .class files generated from the stubs. This way it is not possible to compile groovy files that are not part of the list of files to compile. That means for example if I do "groovyc C.groovy B.java" and B.java depends on a file A.groovy, then this will not compile, because the groovy compiler is not able to reuse the information of the java compiler that a lookup for a A.groovy is needed. Instead. to compile this, "groovyc A.groovy B.java C.groovy" is needed. All files must be known before. This is also the reason that this solution will not compile at runtime, because a discovery mechanism for java files depending on groovy files would be needed and that is not doable by stubs, not wihtout additional information provided by the compiler.