- Communication
- Development Environment Setup
- Eclipse Project Descriptions
- Build with Eclipse
- Test with Eclipse
- Release Build with Maven
- Contribute
- Debugging
groovyc
Command
There is currently no mailing list or official forum dedicated to Groovy-Eclipse development. Bug reports, feature enhancement requests, and development questions can be filed in the Issues section of the Groovy-Eclipse Github repo.
Additional questions and answers might be found by searching for the groovy-eclipse tag on stack overflow and in the Groovy Users group.
Download and run the Eclipse Installer here, then switch the installer to Advanced Mode:
Pick a suitable base package on the product page, Eclipse IDE for Eclipse Committers is a good choice:
Select Next, then locate and check the Groovy-Eclipse project under Github Projects:
The installer will now ask you to make a few choices:
- Where do you want to install the IDE?
- Where do you want the workspace?
- How do you access the Groovy-Eclipse git repository on github? Unless you have write access to the Groovy-Eclipse repository on github, select 'HTTPS (Read-only, Anonymous)' from the dropdown.
- Where do you want to clone the git repository?
- Which target platform do you want?
Select Next when you have set all values to your likings.
The next screen shows the required bootstrap steps for the installation of the IDE. Click Finish to start with the bootstrap process:
The installer will now download the required eclipse bundles and once done, start up the new IDE to continue with the installation. You can close the installer window once this happened:
By the time you switch to the IDE, the installer is probably already cloning the Groovy-Eclipse repository. Click the small circling arrows on the status bar to see what's going on in the background:
The installer then downloads the required target platform bundles, imports the Groovy-Eclipse projects into the workspace and organizes them into working sets. Eventually the setup is done and a build is triggered. After the build completes, your package explorer should look like this.
Close all org.codehaus.groovyXX projects but one -- only one should be open at any time. Now try to run the GroovyJDTTests/AllGroovyTests suites.
Groovy-Eclipse is a Groovy language tooling (similar to JDT or CDT components) integrated into Eclipse. Groovy-Eclipse source code is a set of Eclipse plug-in projects, where each project is contributing Groovy tooling logic into Eclipse via various Eclipse extension points. For example, Groovy-specific launch configurations, compiler, debugger, editor for .groovy
files, etc. Each plug-in project is responsible for some specific feature of the Groovy language tooling support in Eclipse.
This project is a patched version of the Eclipse JDT plug-in that hooks core low-level support for the Groovy language into JDT, since JDT does not provide extension support for this kind of integration. See the LanguageSupportFactory class references (and other classes from groovy
folder under this project) in the project to locate integration points. Issues noticed in Java tooling may sometimes be caused by Groovy-Eclipse because of this project.
This project contains Groovy core logic for parser, compiler, type inferencing, type look-ups, etc. Logic here is being hooked to JDT via the org.eclipse.jdt.core plug-in.
Implementations of Groovy language, where XX stands for Groovy language version. These projects are the source code for Groovy language and are needed in the workspace to make Groovy-Eclipse compile. One can test Groovy-Eclipse for a specific version of Groovy by keeping the desired Groovy language version project opened and the rest closed. If anyone is tempted to change anything in any of these projects, either talk to the Groovy team folks or raise a defect against Groovy language.
Provides the ability to detect and switch between the available versions of Groovy.
Hooks the framework resolve process to prevent linking Groovy to bundles that have optional dependencies.
Integrates JUnits written in Groovy into Eclipse's JUnit framework.
Ant integration for building classes from Groovy code.
Integration of Groovy core components into Eclipse: compiler, launcher, search, type look up, preferences, etc. No UI contributions, just back-end logic.
Various contributions to Eclipse UI components: Preference pages, launch configuration wizard tabs, UI actions, creation wizard for Groovy project, creation wizards for Groovy language artifacts, type browsing, search, etc.
Feature of Groovy source editor (.groovy files editor). Integration of code refactorings for Groovy language into Eclipse. (Right-click on a Groovy statement and select Source -> Refactor.)
Feature of Groovy source editor (.groovy files editor). Integration of code completions for Groovy code. (Ctrl+Space behavior for uncompleted Groovy statements.)
Feature of Groovy source editor (.groovy files editor). Integration of quick fix suggestions for Groovy language. Can either be activated by selecting a statements and pressing Ctrl+1 or by clicking on the error annotation in the .groovy file editor's overview ruler.
Support for Groovy based Domain Specific Language. Provides contents assist, type inferencing, etc. for a DSL defined by a DSL descriptor.
Groovy compiler tests.
If a snippet of code is not building cleanly, it should be captured as a test case in GroovySimpleTest.java For each test, there is either a call to runConformTest()
if the snippet should successfully compile and run, or runNegativeTest()
if it should not compile (in which case it polices the error messages that will come out). Each test is simply the test code captured as a string and then expected output or expected errors. It is possible to pass multiple source files to these run methods.
Java/Groovy builder tests.
If a project is not building cleanly, it should be captured as a test case in BasicGroovyBuildTests.java. These tests represent a typical build flow running against a project.
These tests let you create a project, then add files to it (groovy or java) and then call fullBuild/incrementalBuild to simulate what would happen in a real eclipse and then either police the expected errors or expected output. If you have an issue that says it is failing on an incremental build (but not a full build) you might be creating a BasicGroovyBuildTest.
High-level test suites. (These suites group tests that are located in other test projects.)
This minimal project set should be open in your workspace:
- org.codehaus.groovy.alltests
- org.codehaus.groovy.eclipse
- org.codehaus.groovy.eclipse.ant
- org.codehaus.groovy.eclipse.astviews
- org.codehaus.groovy.eclipse.codeassist
- org.codehaus.groovy.eclipse.codeassist.test
- org.codehaus.groovy.eclipse.codebrowsing
- org.codehaus.groovy.eclipse.codebrowsing.test
- org.codehaus.groovy.eclipse.compilerResolver
- org.codehaus.groovy.eclipse.core
- org.codehaus.groovy.eclipse.core.test
- org.codehaus.groovy.eclipse.dsl
- org.codehaus.groovy.eclipse.dsl.tests
- org.codehaus.groovy.eclipse.frameworkAdapter
- org.codehaus.groovy.eclipse.junit.test
- org.codehaus.groovy.eclipse.quickfix
- org.codehaus.groovy.eclipse.quickfix.test
- org.codehaus.groovy.eclipse.refactoring
- org.codehaus.groovy.eclipse.refactoring.test
- org.codehaus.groovy.eclipse.tests
- org.codehaus.groovy.eclipse.ui
- org.codehaus.groovyXX (where XX is the Groovy version you are working with; you should only have one of these open in your workspace at a time)
- org.eclipse.jdt.core
- org.eclipse.jdt.core.compiler.batch (4.27+)
- org.eclipse.jdt.core.tests.builder
- org.eclipse.jdt.core.tests.builder.mockcompiler (4.33+)
- org.eclipse.jdt.core.tests.compiler
- org.eclipse.jdt.groovy.core
- org.eclipse.jdt.groovy.core.tests.builder
- org.eclipse.jdt.groovy.core.tests.compiler
Note: Only one JDT patch should be imported (org.eclipse.jdt.core
, org.eclipse.jdt.core.compiler.batch
, etc.) and it should be matched to the target platform of your workspace. For example, the patch in the /e434
folder is for Eclipse 4.34 (2024-12).
Right-click on a test class and select Run As -> JUnit Plug-in Test.
For manual testing and debugging, right-click on the org.codehaus.groovy.eclipse.ui project and--depending on what you are trying to do--select Run As -> Eclipse Application or Debug As -> Eclipse Application. This will launch another instance of Eclipse loaded with the plug-ins in the workspace.
From the root directory of the repository, execute the following command to build Groovy-Eclipse for Eclipse 4.34 (2024-12).
```
mvn -Pe4.34 clean verify
```
Replace e4.34 with a different option to build it for another Eclipse version:
- e4.33
- e4.32
- e4.31
- e4.30
- e4.29
- e4.28
- e4.27
- e4.26
- e4.25
- e4.24
- e4.23
- e4.22
- e4.21
- e4.20
- e4.19
Tests will be executed as part of the build. To skip them, append this option to the command: -Dmaven.test.skip=true
.
Before making changes, a Github issue should be created to make others aware of what you plan to work on.
There are currently no coding standards, but ensure your changes match the style of the code that is already present in the project.
Fork the Groovy-Eclipse repository, push your changes to it, and submit a pull request. If you do not know how to do this, see the Github forking guide.
Often defects are addressing something that doesn't compile in Groovy-Eclipse and yet compiles fine when compiled with a groovyc
command executed from command line interface. Such defects would require one to investigate differences between groovyc
command compilation (pure Groovy) and Groovy-Eclipse compilation. This involves debugging groovyc
command execution. There are 2 ways debugging groovyc
command:
- Attach Eclipse debugger to
groovyc
java process - Launch
org.codehaus.groovy.tools.FileSystemCompiler
as a Java Application
It is recommended to have Groovy source from https://github.com/groovy/groovy-core in your workspace as code in Groovy-Eclipse org.codehaus.groovy doesn't exactly match the original groovy code and has a few Groovy-Eclipse-specific fixes.
- Execute the following in the console:
export JAVA_OPTS="--Xdebug --Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=y"
- Start
groovyc
command from the console, e.g.<path to groovyc>/groovyc <groovy files to compile>
. Process should be suspended until debugger is attached. - Create a new 'Remote Java Application' launch configuration in Eclipse. Specify project from the workspace corresponding the version of Groovy for the ran
groovyc
command, leave host as localhost, and specify the port 5000. - Launch the created 'Remote Java Application'.
- Create a new 'Java Application' launch configuration in Eclipse.
- Specify the project from the workspace corresponding the required Groovy version.
- Specify org.codehaus.groovy.tools.FileSystemCompiler as the Main class to launch.
- Specify groovy files to compile (absolute path) on the 'Arguments' tab of the launch configuration dialog in the 'Program Arguments' text box.
- Run the newly created launch configuration.