1

this is driving me crazy - i'm trying to 'fix' a broken plugin and its using Gant scripts.

when i create a script it seems to run it - but if i create an error in a script and try and back the change out by deleting it - running the script a second time throws the same error.

i'm using the grails command history button in GGTS to run the script 'say test-script' where i have a created TestScript in the scripts directory. Its like its somehow caching the scripts- and the last broken one seems to be the one it keeps running -

any ideas how to force it to reload the corrected script on the next run ?

WILLIAM WOODMAN
  • 1,185
  • 5
  • 19
  • 36

1 Answers1

1

Delete the class(es) from the scriptCache folder where they're compiled, which should be in your work directory (target/scriptCache or target/work/scriptCache),

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156
  • ok - i've just buildConfig to store that in my local project target/work directory, rather than under .grails/... however i am puzzled to understand why when i update the script and save (it should now be newer than the cache) - that grails doesnt spot that and recompile the script . why do i have to clear the script cache manually? – WILLIAM WOODMAN Jan 26 '15 at 12:45
  • I'm not sure, definitely seems like a bug because it does work sometimes. But it's a rare enough thing to do and easy enough to work around, so it hasn't risen far on my priority list. – Burt Beckwith Jan 26 '15 at 12:53
  • just tried and its not that easy - i created a script and ran it - i looked in the script cache and it creates xxxScript.class and a xxxScript$_run_closure.class. When you try and delete through GGTS it errors - wheni try to do on the file system the xxxScript.class will go but GGTS has the xxxScript$_run_closure loaded in the VM - and it wont let you delete it. – WILLIAM WOODMAN Jan 26 '15 at 17:28
  • is there a script i can call (ClearScriptCache say ) that would do an clean up and release the script and remove it? at the moment i'd have to stop and start GGTS every time just to delete the cache! – WILLIAM WOODMAN Jan 26 '15 at 17:29
  • do i log this as a jira issue - and more particuarly its a cow trying to fix this plugin i'm wrestling with - as every time i touch and edit a script in that plugin i fall into this issue - is there a cute tactical way to get round this ? – WILLIAM WOODMAN Jan 26 '15 at 17:31
  • looks like cleanAll - is calling cleanWork target in _GrailsClean - which seams to release the lock in GGTS and cleans the script cache in the process - better than stopping /restarting GGTS - so do I need to raise a jira on the not refreshing the script cache issue ? Also can a gant script trigger gradle - and i could try and rebuild the scripts i want as gradle actions, rather than gant scripts with the limitation outlined? – WILLIAM WOODMAN Jan 26 '15 at 22:09