-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.GroovyCastException Exception when using GrettyStartTask #18
Comments
Issue is well-reproducible, I'll try to fix it. |
OK, here is the solution. Replace the line: apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty7-0.0.17.plugin' with: apply plugin: 'gretty7' and then error is gone. Source of the problem seems to be the following: as soon as you include gretty-plugin twice (once in buildscript and again in "grettyX-0.0.X.plugin"), gradle gets confused and cannot load classes properly. General recommendation: |
thanx for solution. but i needed to use classpath in buildscript because otherwise gradle didn't find the GrettyStartTask class at all. |
Ah, I understand. Yes, when you do "apply-from", importing the package does not work. I don't know why - it looks like deficiency/bug in gradle. The complete working solution for you: import org.akhikhl.gretty.*
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty7-plugin:0.0.17'
}
}
repositories {
mavenCentral()
}
apply plugin: 'gretty7'
task ('jettyRunForIntegrationTest', type: GrettyStartTask) {
integrationTest = true
} |
Relevant gradle parts
...
import org.akhikhl.gretty.*
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty7-plugin:0.0.17'
}
}
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty7-0.0.17.plugin'
....
task ('jettyRunForIntegrationTest', type: GrettyStartTask) {
integrationTest = true
}
Result
Exception in thread "Thread-3" org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'org.akhikhl.gretty7.ScannerManager@45b109c6' with class 'org.akhikhl.gretty7.ScannerManager' to class 'org.akhikhl.gretty.ScannerManagerBase'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)
at org.akhikhl.gretty.GrettyStartTask.runJetty(GrettyStartTask.groovy:199)
The text was updated successfully, but these errors were encountered: