Open craigburke opened 10 years ago
Removing asset-pipeline dependency. It's necessary for the grails-run-app task but the issue still remains on the test task without it. Hopefully that helps narrow down any dependency issue.
It looks like it comes from the hibernate4 plugin...as soon as I remove that the error goes away.
is there a global exclude in Grails that we are missing?
FYI. This may be related to known issues mentioned in the release notes.
Recently, I was able to convert an app (v2.4.2) from maven to gradle using this plugin successfully. I am using 4.3.5.5
version of hibernate4
@dmahapatro so the FreshRuntime annotation on your tests resolved this for you or did you have to do something else?
No, I am using 2.4.2 and did not use any of @FreshRuntime or @DirtiesRuntime. One way to confirm this, is if you can use Grails 2.4.2 and see if you still get the same issue. @craigburke. With that the groovyVersion
downgrades to 2.3.3
@dmahapatro I gave that a try, same result unfortunately.
I am thoroughly confused.
If I add -PgrailsArgs="--stacktrace"
to the Gradle command then I don't get the error.
@johnrengelman ok that's just weird.
@johnrengelman -PgrailsArgs="--stacktrace"
still gives me the error actually.
This is what I'm running:
$ rm -r build buildPlugins && gradle grails-test-app -PgrailsEnv=test -PgrailsArgs="--stacktrace"
can you post your entire project somewhere so I'm looking at exactly the same thing?
@craigburke Passed for me for a new grails 2.4.2 app with the same config you have in build.gradle
. Will test the same in 2.4.3. How are you running your test? I used
gradle test
Here's my output:
➜ grails-test rm -r build buildPlugins && gradle grails-test-app -PgrailsEnv=test -PgrailsArgs="--stacktrace"
:grails-test-app
| Loading Grails 2.4.3
| Configuring classpath
| Running pre-compiled script
| Running pre-compiled script.
| Environment set to test
| Environment set to test.
| Environment set to test..
| Environment set to test...
| Environment set to test....
| Environment set to test.....
| Installing zip scaffolding-2.1.2.zip...
| Installing zip scaffolding-2.1.2.zip....
| Installing zip scaffolding-2.1.2.zip.....
| Installed plugin scaffolding-2.1.2
| Installed plugin scaffolding-2.1.2.
| Installed plugin scaffolding-2.1.2..
| Installed plugin scaffolding-2.1.2...
| Installed plugin scaffolding-2.1.2....
| Installed plugin scaffolding-2.1.2.....
| Installing zip hibernate4-4.3.5.5.zip...
| Installing zip hibernate4-4.3.5.5.zip....
| Installing zip hibernate4-4.3.5.5.zip.....
| Installed plugin hibernate4-4.3.5.5
| Installed plugin hibernate4-4.3.5.5.
| Installed plugin hibernate4-4.3.5.5..
| Installed plugin hibernate4-4.3.5.5...
| Installed plugin hibernate4-4.3.5.5....
| Installed plugin hibernate4-4.3.5.5.....
| Installing zip tomcat-7.0.55.zip...
| Installing zip tomcat-7.0.55.zip....
| Installing zip tomcat-7.0.55.zip.....
| Installed plugin tomcat-7.0.55
| Installed plugin tomcat-7.0.55.
| Installed plugin tomcat-7.0.55..
| Installed plugin tomcat-7.0.55...
| Installed plugin tomcat-7.0.55....
| Installed plugin tomcat-7.0.55.....
| Compiling 17 source files
| Compiling 17 source files.
| Compiling 17 source files..
| Compiling 17 source files
| Compiling 17 source files.
| Compiling 17 source files..
| Compiling 17 source files...
| Compiling 17 source files....
| Compiling 17 source files.....
| Compiling 8 source files
| Compiling 8 source files.
| Compiling 8 source files..
| Compiling 8 source files...
| Compiling 8 source files....
| Compiling 8 source files.....
| Compiling 1 source files
| Compiling 1 source files.
| Running 2 unit tests...
| Running 2 unit tests... 1 of 2
| Completed 1 unit test, 0 failed in 0m 2s
| Tests PASSED - view reports in /Users/jengelman/workspace/personal/gradle-stuff/grails-test/build/test-results
BUILD SUCCESSFUL
Total time: 20.07 secs
gradle test
works fine for me as well.
Yes I see the issue using gradle grails-test-app
.
2014-08-19 12:08:06,748 [main] ERROR pojo.BasicLazyInitializer - Javassist Enhancement failed: com.example.Foo
Message: No such property: hasProperty for class: groovy.lang.MetaClassImpl
Line | Method
->> 102 | doCall in _GrailsTest$_run_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 32 | doCall in TestApp$_run_closure1
| 57 | invokeMethod in org.grails.launcher.util.ReflectionUtils
| 409 | launch in org.grails.launcher.context.DelegatingGrailsLaunchContext
| 32 | launch . . . in org.grails.launcher.ReflectiveGrailsLauncher
| 27 | launch in org.grails.launcher.InProcessGrailsLauncher
| 62 | run . . . . in org.grails.launcher.Main
^ 38 | main in ''```
it's somehow related to the GrailsTestTask.getArgs()
method. When I comment that method out, then the error occurs when running tests.
Ok, I believe it's because getArgs()
method in GrailsTask
by default returns a null
instead of an empty String
.
That's causing a problem here: https://github.com/grails/grails-gradle-plugin/blob/8fb1f60a0e158d06f6ff3baed9e9e8d99ba8d6b8/src/main/groovy/org/grails/gradle/plugin/tasks/GrailsTask.groovy#L206 because that is actually evaluating to the String: null --non-interactive
.
And it works fine when you use gradle test
because that task is a GrailsTestTask
, whereas gradle grails-test-app
is a TaskRule that is created using a standard GrailsTask
. GrailsTestTask
overrides the getArgs()
method and returns at minimum ''
.
Still running into the same issue with either gradle test
or gradle grails-test-app
Going to clean everything out, nuke my ~/.gradle folder and start a new project.
@johnrengelman I noticed from your output that your project included a couple unit tests. Should that matter or are you seeing the same result with a clean project that has no tests?
Guess I don't know on that one...didn't try.
I would nuke build
and buildPlugins
in your project folder....~/.gradle
shouldn't have any impact.
Also, have you commented out the dependencies in BuildConfig.groovy
?
I had it commented in my original project, but not my test. I tried that and nuking build and buildPlugins doesn't seem to help.
I did throw a new project that shows exactly what I'm using. Perhaps I'm missing a step or something jumps out at your there? https://github.com/craigburke/grails-gradle-test
Thanks for your patience, I really appreciate your help :)
Hmm. Seems to still happen if there are no tests defined. That's why your project spits the error out and mine doesn't.
And it's only an issue with the unit test phase.
Yeah I was just going to ask that. I had functional tests in my original project but no unit tests.
You're definitely on to something. If I add a simple unit test then the message goes away for me.
I get an error message when I try to run the test task in a project with at least one domain class (I get the same error for every domain class in the project). The tests do in fact run though:
A minimal build.gradle file to reproduce the issue:
After adding the domain class Foo.groovy to a newly initialized grails project then I get the above error
I can send along the full example project if that would be helpful.