I am looked through the documentation, and I have been unsuccessful in figuring out where to find resources for writing Groovy scripts.
I am new to XWiki, I am liking it so far, I am trying to write some onEvent code, and I need the API so I can figure out how to write the code. I have tried using velocity to no avail.
I want to use groovy because I have used Java for close to 10 years now and I’m comfortable with it. I also found that it would be better performance wise.
Like I said, probably and easy answer, I hope, but I have been trying to pin point how to write Groovy code for XWiki for the last few hours, baffled by how anyone knows how to write these groovy scripts that I see in many discussions on the forum.
Yes, I have, and that led me to API Reference. I went on to try to search for classes on Nexus, but I haven’t used Nexus before and I had trouble search for the class, the results were unrelated to the classes I was searching for, like XWikiDocument. I have resorted to going through the GitHub source code on the 15.10.x related branch, and that serves me pretty well.
In order to mark this solved, I would like to know why Nexus is not returning results. I put in the full class name and then it just returns a bunch of artifacts, which I then have to go through and figure out which one it’s in, and that’s not helpful. I figure there has to be an easier way, and that’s why I posted.
The assistance is appreciated and I bet other people in my situation will have the same concern when they are trying to find documentation. I’m not used to having to dig so hard for documentation and then come up empty handed.
Please tell me what class you are looking for. I’m struggling to understand what you are looking for. I’m not a developer myself, but I think I must be able to understand at least what you are trying to achieve.
I like the way this is done to attach the method to a service. I would like to get to that point once I understand the bindings.
What confuses me the most is the bindings in Groovy. The Scripting Documentation API, also available as a nice extension, does not cover the Groovy bindings. Specifically, I do not understand this code from the listener tutorial script.
In velocity, I understand that $xcontext is bound, so I assume the same for xcontext in Groovy. The part I do not understand is xcontext.method… what is going on with those parts of the code? Where can I find the documentation for those bindings? I can figure out the class documentation using Github, I just don’t understand the bindings.
Thank you. I feel silly. I have been on that page a few times, but I looked right past it. I very much appreciate you pointing it out. It will help a lot going forward.