Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,217
Community Members
 
Community Events
176
Community Groups

Looking for a better workflow when updating custom classes in the script editor

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.

 

1 answer

1 accepted

0 votes
Answer accepted

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.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events