I tried running this script as a macro on Magicdraw, but kept getting an error at line 142 where the script calls JsonSlurper. Then, when I tried importing the Jsonslurper function from the Json library import groovy.json.JsonSlurper;
, it gives me a new error at that line. My magicdraw uses Groovy 3.0.7, which I checked has Jsonslurper in its libraries.
I'm not sure how to further figure out where the problem is. I am originally trying to take an excel file, make some new columns, and use those columns to create boxes, ports, and interfaces. I got the excel processing done in Python, but am still figuring out the Magicdraw API.
Error 1:
MagicDraw cannot execute the Groovy macro, please make sure that the C:\Users\elevy\Downloads\rapid-modeling-tools-master\player-piano\player-piano-script.groovy is correct. startup failed: C:\Users\elevy\Downloads\rapid-modeling-tools-master\player-piano\player-piano-script.groovy: 142: unable to resolve class JsonSlurper @ line 142, column 18. jsonSlurper = new JsonSlurper(); ^ 1 error org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: C:\Users\elevy\Downloads\rapid-modeling-tools-master\player-piano\player-piano-script.groovy: 142: unable to resolve class JsonSlurper @ line 142, column 18. jsonSlurper = new JsonSlurper(); ^ 1 error
Error 2:
MagicDraw cannot execute the Groovy macro, please make sure that the C:\Users\elevy\Downloads\rapid-modeling-tools-master\player-piano\player-piano-script.groovy is correct. startup failed: C:\Users\elevy\Downloads\rapid-modeling-tools-master\player-piano\player-piano-script.groovy: 14: unable to resolve class groovy.json.JsonSlurper @ line 14, column 1. import groovy.json.JsonSlurper; ^ 1 error org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: C:\Users\elevy\Downloads\rapid-modeling-tools-master\player-piano\player-piano-script.groovy: 14: unable to resolve class groovy.json.JsonSlurper @ line 14, column 1. import groovy.json.JsonSlurper; ^ 1 error enter code here