2014-02-10 54 views
0

我在使用一些java文件的grails時遇到了麻煩。我有工作的java程序,它正在編譯沒有錯誤,我有幾個grails視圖和控制器工作正常。但是當我將java文件粘貼到src目錄中時,我發現下面的錯誤:Java文件不能與Grails一起工作

看起來像缺少一些庫,但我不知道如何解決它。

Error 500: Internal Server Error 
URI 
/collab-todo/ 
Class 
org.codehaus.groovy.control.MultipleCompilationErrorsException 
Message 
startup failed: Compile error during compilation with javac. 

C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_05_java_binding\RunXML.java:5: error: package org.milyn does not exist import org.milyn.Smooks;^C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_05_java_binding\RunXML.java:6: error: package org.milyn.payload does not exist import org.milyn.payload.JavaResult;^C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_05_java_binding\RunXML.java:7: error: package org.milyn.payload does not exist import org.milyn.payload.StringResult;^C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_07_templating\Run.java:2: error: package org.milyn does not exist import org.milyn.Smooks;^C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_07_templating\Run.java:3: error: package org.milyn.payload does not exist import org.milyn.payload.JavaResult;^C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_07_templating\Run.java:4: error: package org.milyn.payload does not exist import org.milyn.payload.StringResult;^C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_05_java_binding\RunXML.java:20:error: cannot find symbol Smooks smooks = new Smooks(RunXML.class.getResourceAsStream("_xml_configs/smooks-config.xml"));^symbol: class Smooks location: class RunXML C:\Documents andSettings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_05_java_binding\RunXML.java:20: error: cannot find symbol Smooks smooks = new Smooks(RunXML.class.getResourceAsStream("_xml_configs/smooks-config.xml"));^symbol: class Smooks location: class RunXML C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_05_java_binding\RunXML.java:23: error: cannot find symbol StringResult xmlResult = new StringResult();^symbol: class StringResult location: class RunXML C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_05_java_binding\RunXML.java:23: error: cannot find symbol StringResult xmlResult = new StringResult();^symbol: class StringResult location: class RunXML C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_05_java_binding\RunXML.java:24: error: cannot find symbol JavaResult javaResult = new JavaResult();^symbol: class JavaResult location: class RunXML C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_05_java_binding\RunXML.java:24: error: cannot find symbol JavaResult javaResult = new JavaResult();^symbol: class JavaResult location: class RunXML C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_07_templating\Run.java:14: error: cannot find symbolSmooks smooks = new Smooks("/_07_templating/smooks-config.xml");^symbol: class Smooks location: class Run C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_07_templating\Run.java:14: error: cannot find symbol Smooks smooks = new Smooks("/_07_templating/smooks-config.xml");^symbol: class Smooks location: class Run C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_07_templating\Run.java:17: error: cannot find symbol StringResult ediResult = new StringResult();^symbol: class StringResult location: class Run C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_07_templating\Run.java:17: error: cannot find symbol StringResult ediResult = new StringResult();^symbol: class StringResult location: class Run C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_07_templating\Run.java:18: error: cannot find symbol JavaResult javaResult = new JavaResult();^symbol: class JavaResult location: class Run C:\Documents and Settings\XPMUser\collab-todo\src\java\Smooks\src\main\java\_07_templating\Run.java:18: error: cannot find symbol JavaResult javaResult = new JavaResult();^symbol: class JavaResult location: class Run 18 errors 1 error

+0

這是一個類路徑問題,它看起來像你把你的Java文件放在錯誤的目錄中(使用Maven,他們進入了'src/main/java/my/package/MyClass.java',並且你有重複的目錄名)。 – chrylis

回答

1

它看起來是你缺少由org.milyn識別庫(Smooks的)。 (jar)庫應該放置在lib目錄中,或者通過BuildConfig.groovy中的依賴項來獲取它。

相關問題