unit-testing - 使用 IVY 解析器进行 Grails 2.3 单元测试

标签 unit-testing maven grails ivy spock

如果我使用 grails 2.3 执行 create-app,创建一个简单的 spock 单元测试,并更改 en 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 中,但我不希望我的凭据受源代码控制:)

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

最佳答案

这个问题是因为“臭名昭著的”intellij 修复了 idea 12 和 grails 2.3 - 恢复了“sources”和“javadoc”jar 文件,解决了这个问题!

关于unit-testing - 使用 IVY 解析器进行 Grails 2.3 单元测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18894978/

相关文章:

java - Hibernate - 有没有办法获取违反约束的列的名称?

java - 如何不生成maven jar

grails - 谷歌地方 API : Adding a new Place: Java/Groovy

grails install-plugin 对我不起作用

unit-testing - 包中的模拟方法

reactjs - Jest 和 Enzyme 单元测试 : TypeError: Cannot read property 'push' of undefined

c# - NUnit 以编程方式设置测试名称

ios - 将单元测试移动到 xcode 中的不同文件夹

netbeans - 如何在 Netbeans Maven Web 项目中分析 Jetty 应用程序?

security - 如何在数据库上安全地存储用户名/密码(哈希不会)