Grails 2.3使用IVY旋转变压器进行单元测试

时间:2013-09-19 12:45:43

标签: unit-testing maven grails ivy spock

如果我使用grails 2.3进行create-app,请创建一个简单的spock单元测试,并更改配置,以使用常春藤解析器:

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中,但我不想在源代码控制下使用我的凭据:)

编辑(已解决):查看评论!

1 个答案:

答案 0 :(得分:0)

这个问题是因为臭名昭着的" intellij修复了想法12和grails 2.3 - 恢复"来源"和" javadoc" jar文件,修复问题!