I am trying to run the Hello World example from here http://www.gpars.org/webapp/guide/index.html#_download_and_install But I get the error: Unable to resolve class groovyx.gpars.actor.Actors.actor
I'm using groovy version 2.4.16 and JVM 11.0.3 on linux
This is the code..
import static groovyx.gpars.actor.Actors.actor
def decryptor = actor {
loop {
react { message ->
if (message instanceof String) reply message.reverse()
else stop()
}
}
}
def console = actor {
decryptor.send 'lellarap si yvoorG'
react {
println 'Decrypted message: ' + it
decryptor.send false
}
}
[decryptor, console]*.join()
To get this working I had to do completely remove the old groovy and install the new version with sdkman. Like so..
$ apt remove groovy
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk install groovy
In my case I also needed to add the JAVA_HOME variable.