gpt4 book ai didi

Grails 2.2 到 2.3 - 运行 fork 测试应用程序 : Could not load grails build listener class 时出错

转载 作者:行者123 更新时间:2023-12-04 11:39:00 26 4
gpt4 key购买 nike

我正在将我的项目从 grails 2.2 迁移到 2.3,当我执行 test-app(在 IDEA 12.1.6 上)时,出现此错误

| Error Error running forked test-app: Could not load grails build listener class
java.lang.RuntimeException: Could not load grails build listener class
at org.codehaus.groovy.grails.cli.support.GrailsBuildEventListener.addGrailsBuildListener(GrailsBuildEventListener.java:258)
at org.codehaus.groovy.grails.cli.support.GrailsBuildEventListener.loadGrailsBuildListeners(GrailsBuildEventListener.java:106)
at org.codehaus.groovy.grails.cli.support.GrailsBuildEventListener.initialize(GrailsBuildEventListener.java:73)
at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProjectClassExecutor.createEventListener(ForkedGrailsProjectClassExecutor.groovy:102)
at org.codehaus.groovy.grails.cli.fork.testing.ForkedGrailsTestRunner.createInstance(ForkedGrailsTestRunner.groovy:93)
at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProjectClassExecutor.initializeProjectInstance(ForkedGrailsProjectClassExecutor.groovy:85)
at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProjectClassExecutor.run(ForkedGrailsProjectClassExecutor.groovy:72)
at org.codehaus.groovy.grails.cli.fork.testing.ForkedGrailsTestRunner.main(ForkedGrailsTestRunner.groovy:75)
Caused by: java.lang.ClassNotFoundException: org.jetbrains.groovy.grails.rt.GrailsIdeaTestListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:648)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:758)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:746)
at org.codehaus.groovy.grails.cli.support.GrailsBuildEventListener.addGrailsBuildListener(GrailsBuildEventListener.java:255)
... 7 more
| Error Error running forked test-app: Could not load grails build listener class
| Error Forked Grails VM exited with error

我的 BuildConfig.groovy 看起来像这样:
grails.servlet.version = "3.0" 
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.work.dir = "target/work"
grails.project.target.level = 1.6
grails.project.source.level = 1.6

grails.project.fork = [
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]

grails.project.dependency.resolver = "maven" // or ivy

grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "error"
checksums true
legacyResolve false

repositories {
inherits true // Whether to inherit repository definitions from plugins

grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
}

dependencies {
runtime 'mysql:mysql-connector-java:5.1.24'
}

plugins {
build ":tomcat:7.0.42"

compile ":scaffolding:2.0.1"
compile ':cache:1.1.1'

runtime ":hibernate:3.6.10.2" // or ":hibernate4:4.1.11.2"
runtime ":jquery:1.10.2"
runtime ":resources:1.2.1"
}
}

怎么了 ?

最佳答案

目前,为了利用 IntelliJ 中新的 Grails fork 测试功能,您需要 find the grails-rt.jar file under your IntelliJ installation directory ,并将其复制到您的 grails 项目 lib 目录,或通过类路径使其可用于您的 grails 应用程序。

就我而言,在 Mac OS X 上,grails-rt.jar 文件位于:

/Applications/IntelliJ\ IDEA\ 13.app/plugins/Grails/lib/grails-rt.jar

我将此文件复制到 ~/MyGrailsApp/lib .

关于Grails 2.2 到 2.3 - 运行 fork 测试应用程序 : Could not load grails build listener class 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19613363/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com