Frage

I have some java projects that have been around for a long time and am currently using a pretty recent version of SpringSource Toolsuite and the groovy plugin which works fine (this was added for people who don't read beyond the first paragraph).

I can create a Groovy project or I can convert a Java project to a groovy project, but I'd really like to add a Groovy nature to my java project (I don't think the team would be very happy about me converting all the projects over to groovy projects!)

The problem is that the "Groovy" menu item containing "Add Groovy Nature" doesn't appear in any java projects (legacy projects or new ones I create). It appears in a Groovy project with "Remove Groovy Nature", but not in java projects.

Everything else works pretty well.

Oh also, not using maven, just straight eclipse & ant--I can deal with the Ant part it's just the eclipse integration that's being probleematic.

Am I missing a setting or something?

War es hilfreich?

Lösung

My colleague and I had the same problem today. We manually fixed it using basically this process:

  1. Clean all projects without starting a new build.
  2. Exit eclipse.
  3. Add/edit the project configuration files below.
  4. Start eclipse.
  5. Refresh project.
  6. Enable Project->Build Automatically.

Here are the files to add/edit:

  • .project : Add this line to the <natures> element:

    <nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
    
  • .classpath : Add this line:

    <classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
    
  • .settings/org.eclipse.jdt.groovy.core.prefs : New file:

    eclipse.preferences.version=1
    groovy.compiler.level=-1
    

Note that the target project was already a java project. To add this stuff to a plain or other non-java project, you might also need to add the following:

  • .project :

    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
    
  • .classpath : Copy from one of your java projects and edit appropriately. Here's a default .classpath file:

    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="output" path="bin"/>
    </classpath>
    

Andere Tipps

Install Groovy eclipse plugin

http://groovy.codehaus.org/Eclipse+Plugin

enter image description here

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top