簡體   English   中英

帶有 Grails Spock 插件的 ClassNotFoundException

[英]ClassNotFoundException with Grails Spock Plugin

我有一個 Grails 1.3.7 項目,但是當我安裝 Grails Spock 插件時:我得到了這個:

    Installed plugin spock-0.5-groovy-1.7 to location /Users/tiffany/.grails/1.3.7/projects/grails-with-spock/plugins/spock-0.5-groovy-1.7. ...
Resolving plugin JAR dependencies ...
[Fatal Error] settings.xml:19:2: The markup in the document following the root element must be well-formed.
WARNING: Dependencies cannot be resolved for plugin [spock] due to error: The markup in the document following the root element must be well-formed.
Executing spock-0.5-groovy-1.7 plugin post-install script ...
Plugin spock-0.5-groovy-1.7 installed
   [delete] Deleting directory /Users/tiffany/Workspace/chrome-webstore/grails-with-spock/target/classes
   [delete] Deleting directory /Users/tiffany/.grails/1.3.7/projects/grails-with-spock/plugin-classes
   [delete] Deleting directory /Users/tiffany/.grails/1.3.7/projects/grails-with-spock/resources

當我嘗試運行一個簡單的域 UnitSpec 時,我得到了這個堆棧跟蹤:

[Fatal Error] settings.xml:19:2: The markup in the document following the root element must be well-formed.
WARNING: Dependencies cannot be resolved for plugin [spock] due to error: The markup in the document following the root element must be well-formed.
Resolving dependencies...
Dependencies resolved in 1284ms.
Running script /Users/tiffany/dev/grails/scripts/TestApp.groovy
Environment set to test
    [mkdir] Created dir: /Users/tiffany/.grails/1.3.7/projects/grails-with-spock/plugin-classes
  [groovyc] Compiling 2 source files to /Users/tiffany/.grails/1.3.7/projects/grails-with-spock/plugin-classes
    [mkdir] Created dir: /Users/tiffany/Workspace/chrome-webstore/grails-with-spock/target/classes
  [groovyc] Compiling 7 source files to /Users/tiffany/Workspace/chrome-webstore/grails-with-spock/target/classes
Error executing script TestApp: java.lang.ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType
java.lang.ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:590)
    at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: java.lang.ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java_lang_ClassLoader$loadClass.call(Unknown Source)
    at _Events$_run_closure1_closure5.doCall(_Events.groovy:18)
    at _Events$_run_closure1.doCall(_Events.groovy:24)
    at _Events$_run_closure2.doCall(_Events.groovy:30)
    at _Events$_run_closure2.doCall(_Events.groovy)
    at _Events$_run_closure3.doCall(_Events.groovy:39)
    at org.apache.tools.ant.BuildListener$targetStarted.call(Unknown Source)
    at TestApp$_run_closure1.doCall(TestApp.groovy:82)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    ... 10 more
--- Nested Exception ---
java.lang.ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java_lang_ClassLoader$loadClass.call(Unknown Source)
    at _Events$_run_closure1_closure5.doCall(_Events.groovy:18)
    at _Events$_run_closure1.doCall(_Events.groovy:24)
    at _Events$_run_closure2.doCall(_Events.groovy:30)
    at _Events$_run_closure2.doCall(_Events.groovy)
    at _Events$_run_closure3.doCall(_Events.groovy:39)
    at org.apache.tools.ant.BuildListener$targetStarted.call(Unknown Source)
    at TestApp$_run_closure1.doCall(TestApp.groovy:82)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:590)
    at gant.Gant.executeTargets(Gant.groovy:589)

有沒有人遇到過這個問題? 如果是這樣,我該如何解決這個問題? 我試過谷歌搜索,但我什么也沒得到>.<

我還嘗試創建一個新的 Grails 應用程序,只安裝了 Spock 插件,沒有別的。 我得到了完全相同的結果。

其中許多問題可以通過簡單的grails clean解決,或者即使這樣也無濟於事,請嘗試刪除用戶目錄中的.grails文件夾並再次運行插件安裝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM