Using java code in a grails application causes compilation never ending loop
I have an application that I am working on modifying and I am having a problem and not sure where to look.
When I first started trying to compile the problem, some of the groovy files had imports that were not resolving correctly. After some tracking down, I see that the package was not defined the way the groovy files were expecting. So I change the package to match what the .groovy files were expecting, and when I run grails test run-app, it compiles, using groovyc, and gives no errors. The problem is, it seems to be infinitely recompiling my java source files. I am only guessing at this, because I only have 12 java files, and that is how many it says it is compiling. Here is the output
Running script C:\Program Files\grails\grails-1.1.2\scripts\RunApp.groovy
Environment set to test
[mkdir] Created dir: C:\Users\dcole\SKillsDB\trunk\web-app\plugins\help-balloons-1.1
[copy] Copying 7 files to C:\Users\dcole\SKillsDB\trunk\web-app\plugins\help-balloons-1.1
[copy] Copied 3 empty directories to 1 empty directory under C:\Users\dcole\.grails\1.1.2\projects\trunk\resources
[mkdir] Created dir: C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
[groovyc] Compiling 12 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
[groovyc] Compiling 72 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
[mkdir] Created dir: C:\Users\dcole\.grails\1.1.2\projects\trunk\resources\grails-app\i18n
[native2ascii] Converting 12 files from C:\Users\dcole\SKillsDB\trunk\grails-app\i18n to C:\Users\dcole\.grails\1.1.2\projects\trunk\resources\grails-app\i18n
[copy] Copying 1 file to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
[copy] Copying 1 file to C:\Users\dcole\.grails\1.1.2\projects\trunk\resources
[copy] Copied 2 empty directories to 2 empty directories under C:\Users\dcole\.grails\1.1.2\projects\trunk\resources
[copy] Copied 7 empty directories to 5 empty directories under C:\Users\dcole\.grails\1.1.2\projects\trunk\resources
[copy] Copying 1 f开发者_JAVA百科ile to C:\Users\dcole\.grails\1.1.2\projects\trunk
Running Grails application..
Server running. Browse to http://localhost:8080/SkillsDB
[groovyc] Compiling 11 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
[groovyc] Compiling 12 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
Running Grails application..
Server running. Browse to http://localhost:8080/SkillsDB
[groovyc] Compiling 11 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
[groovyc] Compiling 12 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
Running Grails application..
Server running. Browse to http://localhost:8080/SkillsDB
[groovyc] Compiling 11 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
[groovyc] Compiling 12 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
Running Grails application..
Server running. Browse to http://localhost:8080/SkillsDB
[groovyc] Compiling 11 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
[groovyc] Compiling 12 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
Running Grails application..
Server running. Browse to http://localhost:8080/SkillsDB
[groovyc] Compiling 11 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
[groovyc] Compiling 12 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
Running Grails application..
Server running. Browse to http://localhost:8080/SkillsDB
[groovyc] Compiling 11 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
[groovyc] Compiling 12 source files to C:\Users\dcole\.grails\1.1.2\projects\trunk\classes
What should I start tracking down to solve this problem? It almost seems like a circular dependency? I am new to grails, so this is all new to me.
This will happen when the class name doesn't match the file name, or the package doesn't match the folder structure. So you must still need some changes in package <-> folder structure. e.g. com.foo.bar.StringUtils must be in src/java/com/foo/bar/StringUtils.java or src/groovy/com/foo/bar/StringUtils.groovy
When it's less obvious which files are getting recompiled you can sort the classes in the compile dir by last edited or created date. The newest files will be first and will be the one(s) that are the culprits.
精彩评论