Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
{table-plus:autoNumber=true|border=2|highlightColor=#6699CC|width=999px|enableSorting=false|columnAttributes=style="width:30%; border:1;",style="width:70%; border:1;"}
|| Do || See ||
|In Eclipse, click *File > New > Groovy Project*.\\{quote}If *Groovy Project* does not appear in the drop-down list, then select *Other* and search for *Groovy Project* in the dialog box.{quote} |!FileNewGroovyProject.jpg!|
|In the *New Groovy Project* wizard, type a name in the *Project Name* box, and click *Next*. \\ \\ {quote}GroovyEclipse creates the project and a folder structure for it. A folder with the same name as the project appears in the Package Explorer. The project directory contains a {{src}} and a {{bin}} folder, each empty.{quote}|!NewGroovyProject.png!|
|The tabs and options in the *Build Settings* window are identical to those in the the Java Development Tool (JDT). \\ \\ Click *Finish* to proceed without customizing the build settings. \\ \\ {quote}For information about build options, see Eclipse help for the *New Java Project Wizard*; it applies to Groovy projects as well.{quote} |!BuildSettings.png!|
|Select the project in the Package Explorer, and click *File > New > Groovy Class*.|!GroovyClassA.png!|
|In the *Groovy Class* wizard, type a name for the class in the *Name* box, a name for the package in the *Package* field, and click *Finish* to create the class and package. \\ \\ {quote}If you type the name of an existing package in the *Package* field, the class is created there. \\ \\ Just like in the JDT, you can create a package as a separate step with *File > New > Package*, or when you use the create the first class{quote}|!CreateANewGroovyClass.png!|
|GroovyEclipse creates the new class. The new class, {{Greetings.groovy}} in this example, is listed in the Package Explorer, and opened in the editor. \\ \\ {quote}Note that, as generated by GroovyEclipse {{Greetings.groovy}} already contains the package statement and class declaration.{quote} |!ClassCreatedA.png!|
|Paste this code into the file: \\ \\ {{static void main(def args)}} { \\    {{def mygreeting = "Hello World"}} \\      {{println mygreeting}} \\ } |!CodeAddedA.png!|
|Right click anywhere in the editor and then *Run > Run As > Groovy Script* or *Java Application*.\\ {quote}Running as an _Application_ will launch the compiled *.class files, whereas running as a _Script_ will launch the uncompiled *.groovy files. In general, the results will be the same, but there are some subtle differences between the two.{quote}|!RunRunAs.png!|
|The greeting is issued in the *Console* tab. |!GreetingIssuedA.png!|
{table-plus}

...