如果我create-app
使用 grails 2.3,创建一个简单的 spock 单元测试,并更改 grails 的配置以使用 ivy 解析器:
grails.project.dependency.resolver = "ivy" // or maven
单元测试崩溃并出现以下错误:
| Running without daemon...
| Running 1 unit test...
| Running 1 unit test... 1 of 1
| Error Error running unit tests: org/hamcrest/SelfDescribing (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1259)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1259)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1259)
Caused by: java.lang.ClassNotFoundException: org.hamcrest.SelfDescribing
... 7 more
| Error Error running unit tests: org/hamcrest/SelfDescribing
| Running 1 unit test....
| Running 1 unit test.....
| Tests FAILED - view reports in C:\ivytry\foobar\target\test-reports
任何想法如何解决这个问题?我们需要使用 Ivy 的原因是 Maven 似乎不支持自定义远程存储库,我需要在其中指定用户名/密码。-除了在 buildconfig 中,但我不希望我的凭据受源代码控制:)
编辑(已解决): 查看评论!