Skip to content

Instantly share code, notes, and snippets.

@justinstoller
Created February 29, 2012 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinstoller/1939197 to your computer and use it in GitHub Desktop.
Save justinstoller/1939197 to your computer and use it in GitHub Desktop.
jenkins_triggers
root@ubuntu-precise:~/work/my_trigger# cat views/my_trigger/config.erb
<%
f = taglib('lib/form')
f.entry :title => 'MyTrigger', :field => 'my_trigger_text_box_entry',
:description => 'This is the form field for MyTrigger' do
f.textbox :title => 'MyTriggers TextBox', :field => 'my_trigger_text_box'
end
%>
root@ubuntu-precise:~/work/my_trigger# cat models/my_trigger.rb
module Jenkins
class Plugin
class Proxies
class TriggerDescriptorProxy < Java.hudson.triggers.TriggerDescriptor
include Jenkins::Model::RubyDescriptor
end
class TriggerProxy < Java.hudson.triggers.Trigger
include Jenkins::Plugin::Proxies::Describable
include Java.jenkins.ruby.Get
include Jenkins::Plugin::Proxy
def initialize(plugin, object)
super plugin, object, Java.hudson.model.Item.java_class
end
end
end
end
class Trigger
include Jenkins::Model
include Jenkins::Model::Describable
describe_as Java.hudson.triggers.Trigger
# descriptor_is Jenkins::Plugin::Proxies::TriggerDescriptorProxy
def initialize(item)
@item = item
super item
end
Jenkins::Plugin::Proxies.register self,
Jenkins::Plugin::Proxies::TriggerProxy
end
class MyTrigger < Trigger
display_name "MyTrigger"
def initialize(attrs)
super
end
end
end
[Winstone 2012/02/29 08:23:37] - Untrapped Error in Servlet
javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: jar:file:/root/work/jenkins-home-tmp/war/WEB-INF/lib/jenkins-core-1.447.jar!/lib/hudson/project/config-trigger.jelly:31:84: <j:invokeStatic> method for_ threw exception: org.jruby.proxy.hudson.model.Descriptor$Proxy0 cannot be cast to hudson.triggers.TriggerDescriptor
at org.kohsuke.stapler.jelly.JellyFacet$1.dispatch(JellyFacet.java:101)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
---snip---
at java.lang.Thread.run(Thread.java:679)
Caused by: org.apache.commons.jelly.JellyTagException: jar:file:/root/work/jenkins-home-tmp/war/WEB-INF/lib/jenkins-core-1.447.jar!/lib/hudson/project/config-trigger.jelly:31:84: <j:invokeStatic> method for_ threw exception: org.jruby.proxy.hudson.model.Descriptor$Proxy0 cannot be cast to hudson.triggers.TriggerDescriptor
at org.apache.commons.jelly.tags.core.InvokeStaticTag.doTag(InvokeStaticTag.java:148)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:270)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
at org.kohsuke.stapler.jelly.JellyFacet$1.dispatch(JellyFacet.java:93)
... 31 more
---snip---
Caused by: java.lang.ClassCastException: org.jruby.proxy.hudson.model.Descriptor$Proxy0 cannot be cast to hudson.triggers.TriggerDescriptor
at hudson.triggers.Trigger.for_(Trigger.java:306)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.commons.jelly.tags.core.InvokeStaticTag.doTag(InvokeStaticTag.java:125)
... 79 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment