我是Grails newb。本周之前,我从未接触过它。
Grails version: 2.5.4
Java version "1.8.0_101"
当我使用以下命令运行单元测试时会发生这些故障:
grails test-app
我已经改变了很多东西,代码似乎按原样编译。
我看到的堆栈跟踪示例:
| Failure: testUpdate(com.xyz.pdq.WidgetControllerTests)
| java.lang.NoClassDefFoundError: org/grails/datastore/mapping/query/api/BuildableCriteria
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1336)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1197)
at java.beans.Introspector.getBeanInfo(Introspector.java:426)
at java.beans.Introspector.getBeanInfo(Introspector.java:173)
at grails.test.mixin.domain.TestGormEnhancer.getStaticApi(DomainClassUnitTestMixin.groovy:188)
at org.grails.datastore.gorm.GormEnhancer.addStaticMethods(GormEnhancer.groovy:118)
at org.grails.datastore.gorm.GormEnhancer.enhance(GormEnhancer.groovy:112)
at org.grails.datastore.gorm.GormEnhancer.enhance(GormEnhancer.groovy:95)
at grails.test.mixin.domain.DomainClassUnitTestMixin.mockDomains(DomainClassUnitTestMixin.groovy:99)
Caused by: java.lang.ClassNotFoundException: org.grails.datastore.mapping.query.api.BuildableCriteria
at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:179)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:151)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 12 more
我正在使用以下内容:
plugins {
runtime ":hibernate4:4.3.5.2"
runtime ":jquery:1.11.1"
runtime ":resources:1.2.14"
build ":tomcat:7.0.52.1"
runtime ":database-migration:1.4.1"
compile ':cache:1.1.8'
}
我可以通过什么方法跟踪它,假设它与依赖关系相关?
依赖关系报告显示我确实有这个:
org.grails:grails-datastore-core:3.1.0.RELEASE
......正如依赖报告摘录中所述:
...
+--- org.grails.plugins:hibernate4:4.3.5.2
| \--- org.hibernate:hibernate-ehcache:4.3.5.Final
| \--- org.jboss.logging:jboss-logging-annotations:1.2.0.Beta1
| \--- org.hibernate:hibernate-core:4.3.5.Final
| \--- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final
| \--- antlr:antlr:2.7.7
| \--- org.jboss:jandex:1.1.0.Final
| \--- org.hibernate:hibernate-validator:5.0.3.Final
| \--- com.fasterxml:classmate:1.0.0
| \--- net.sf.ehcache:ehcache-core:2.4.8
| \--- org.jboss.logging:jboss-logging:3.1.0.GA
| \--- org.grails:grails-datastore-core:3.1.0.RELEASE
| \--- javax.transaction:jta:1.1
| \--- org.grails:grails-datastore-gorm:3.1.0.RELEASE
| \--- org.grails:grails-datastore-gorm-hibernate4:3.1.0.RELEASE
| \--- org.hibernate.common:hibernate-commons-annotations:4.0.4.Final
| \--- org.grails:grails-datastore-gorm-hibernate-core:3.1.0.RELEASE
| \--- org.grails:grails-datastore-gorm-plugin-support:3.1.0.RELEASE
| \--- org.springframework:spring-orm:4.1.8.RELEASE
| \--- dom4j:dom4j:1.6.1
| \--- org.grails:grails-datastore-simple:3.1.0.RELEASE
...
此模式在运行时和测试中都会重复。