![]() ![]() But we noticed if a certain artifacts is created in groovy script like a class definition e.g. In our above example we saw, in Intellij Community edition, no 'run' action was available for our simple Groovy script and we had to create a run configuration manually. There you will find the right click menu to run the Groovy script directly: Community edition and run action Intellij (including Community edition) provides very quick code autocompletion, help documents and error indications: Using Intellij Ultimate Īfter adding JAXB Jar, run Groovy Script by clicking green run button (make sure our hello-groovy-script is selected in run configuration): Code Autocompletion If you don't add the JAXB Jars then you will have following exception on running the script: Information:Groovyc: While compiling groovy-hello-world:: Unable to load class .extensions.JaxbExtensions due to missing dependency javax/xml/bind/JAXBContext at .v5.nfigureClassNode(Java5.java:408) at .ClassNode.laz圜lassInit(ClassNode.java:280) at .ClassNode.getMethods(ClassNode.java:400) at .(MacroMethodsCache.java:88) at .$000(MacroMethodsCache.java:45) at .transform.MacroMethodsCache$2.onModule(MacroMethodsCache.java:69) at .(ExtensionModuleScanner.java:87) at .(ExtensionModuleScanner.java:81) at .(ExtensionModuleScanner.java:63) at .(ExtensionModuleScanner.java:54). Open 'Project Structure' dialog, then select 'Dependencies' tab and add the dependencies as shown: Groovy comes with extra JAXB Jars so we can add them. If you are using Java 9/10/11 then make sure you have entered following in the VM Options: -add-opens=java.base/java.lang=ALL-UNNAMED -add-opens=java.base/=ALL-UNNAMEDĪlso you have to add JAXB dependencies if you are using Groovy 2.5.3 + Java 11 (also check out Java 11 related change ). ![]() In Intellij Community edition there's no right click menu option to run the script directly (Ultimate edition has, which we will see later in this tutorial), so we have to create a run configuration manually.Ĭlick on 'Add Configuration' in the tool bar and click on the + button on left and select 'Groovy' as shown: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |