What is latest recommendation of Groovy Eclipse Pluigin support to use with Buildship?

(Steve Cohen) #1

OK, I have just installed a new version of Eclipse Neon (4.6.3). I installed Buildship from the Eclipse Market place, and when I do that, everything looks good. My gradle scripts in the workspace show the elephant icon.

But I also have some gradle plugins written in groovy that I develop in this environment and I’d like to have a groovy editor.I tried to install the one at http://dist.springsource.org/snapshot/GRECLIPSE/e4.6/ and after this is installed, all my gradle scripts have some sort of error icon, although they still work.

What groovy plugin is recommended for gradle plugin development in Eclipse that does not mess with gradle? I know this question has been discussed before but not for a couple of years and much has changed since then

(Stefan Oehme) #2

Just go into the workspace preferences and remove **/*.gradle from the script path (or similar, forgot the exact name of the property).

(Steve Cohen) #3

So I take it that this is the correct plugin to install? I also question this, because once I had it installed previously, I could never do an automatic Eclipse upgrade. It would always fail. After my Eclipse got totally messed up I was forced to reinstall, which is why I am using a fresh version of Eclipse.

Regardless of these concerns,I reinstalled the Groovy plugin. Trying your suggestion, I presume you meant
Window --> Preferences -> Groovy -->Compiler -->Groovy Script Folders. Your suggestion is to remove *.gradle, but I find that *.gradle is not included in the list to begin with.

(Steve Cohen) #4

(mauromol) #5

It’s sad to say, but for me the latest recommendation is to avoid Groovy at all if you use Eclipse :frowning:

Even if you succeed to make things look like you request in the linked Greclipse bug report, what do you expect from the Groovy-Eclipse editor on .gradle files? In my experience you get nothing more than a plain text editor.

(uklance) #6

Please keep in mind that editing maven pom.xml in eclipse is also pretty much a plain text editor

If you want groovy editor help for gradle scripts, put everything in a plugin

// build.gradle
apply plugin: MyPlugin
// buildSrc/src/main/groovy/MyPlugin.groovy
class MyPlugin implements Plugin<Project> {
   void apply(Project project) {
      project.with {
         apply plugin: 'java' 
         dependencies { ... } 
         tasks.create('foo') { ... } 

(Steve Cohen) #7

Sad but maybe true, if I don’t get some results from my Groovy-Eclipse issue. I think I will keep it for now and live with the ugly icons. On a complicated build script, the syntax highlighting and help is often useful.

(davidmichaelkarr) #8

To be fair, that’s an oversimplification. Completion on configuration elements per plugin, navigation to parent pom, form-based pom editor, and the search facility for dependencies, are all useful features. I would almost consider creating a dummy maven project in my workspace just for that last feature.

Unresolved manifest dependency
(uklance) #9

I can’t say I’ve discovered the auto completion you mention. The pom editor to me is just an xml editor, it closes tags and helps with indenting. As for the form based editor, I’ve never in my life found that useful. Never seen another developer use it either.

Agreed that the maven dependency search / tree is fantastic. I’d love to see a similar feature in buildship.

(Steve Cohen) #10

The latest version of the Groovy plugin has solved this issue. The Elephant Icon is shown for all gradle scripts if the buildship plugin is installed. See https://github.com/groovy/groovy-eclipse/issues/277#issuecomment-292558165