You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi,
I have created a custom class in the script editor. Let's assume it is "MyClass" in the package "my.package". When I go to the console, I can import that class with "import my.package.MyClass", instantiate it and run a method on it. So far so good.
What worries me is that when I chance the code in my class, it is not immediately visible to the console as the class is being cached. I learned that I need to clear the Groovy classloader, but when I do that my class actually completely vanishes. If I run the same code in the console (which worked before), it now says, that it cannot find the class.
I explicitly need to run the Groovy class file in the console to get it loaded again. After that the code will start working again.
I am not not sure what I am doing wrong. I do not have an issue with running the Groovy classloader, but the class should then be found again.
Can you help?
Tobias.
In my experience, you can cause the updated class to be re-compiled by changing the console script.
Even adding a space on a blank line suffices.
If your script points to MyClassA, and MyClassA has a dependency to MyClassB. This will only work if MyClassA change. It won't if only MyClassB changes. In this case, you want to make a change to MyClassA as well as the Console. The console change will cause MyClassA to be checked for changes. The change will cause MyClassB to be checked.
Stupid me. The groovy file names in the Script Editor need to carry the exact name of the class they are carrying, so my class needed to be on the file "my/package/MyClass.groovy". Sorry for the fuzz.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.