How to use eclim with gradle project
Asked Answered
L

3

5

My eclim setup working perfectly with eclipse project. But I want to use gradle build system. I am working with Libgdx framework and it provide gradle templete project. So is there any way to use eclime + eclipse + gradle

Lutes answered 6/4, 2014 at 14:18 Comment(0)
T
3

Your best bet is to check out the Eclipse Gradle plugin, although in short you can add apply plugin: 'eclipse' to your project and then run gradle eclipse from your terminal in the root folder of your project. That should generate the necessary files for Eclipse to recognize your project, although you might need to edit the .classpath file for proper autocompletions.

That will get Eclim to recognize your project with :ProjectOpen and proper autocompletion and other goodness.

The bad is that Gradle tasks and changes to your build.gradle will require manual changes to the Eclipse side of things.

Edit: There's a new plugin available for this purpose that replaces eclim for gradle projects (but is android oriented) called Vim-Grand. It's pre-alpha and you'll want the refactor branch for now, but it's working well enough for me

Trixie answered 12/5, 2014 at 0:6 Comment(1)
But where are routes for classpaths?Gramarye
S
2

You should combine it with YouCompleteMe.

What I did was use the gdx-setup.jar to create my project. I then imported it into eclipse like a normal gradle project. I closed eclipse and started up elcimd. Put "let g:EclimCompletionMethod = 'omnifunc'" in my .vimrc file. Followed the elcim instructions to use :CreateProject and that was it.

This guide was really helpful: http://www.lucianofiandesio.com/vim-configuration-for-happy-java-coding

Savoirvivre answered 9/5, 2014 at 2:59 Comment(7)
How do you run your android/desktop project from vim. Can you please tell me more, how you use :CreateProject. Because it is multi-module project. Did I need to do it with every module.Lutes
I map <leader>g to build from within VIM which basically runs ./gradlew desktop:run. Like this: nnoremap <expr> <leader>g system('./gradlew desktop:run') You can of course map many if you are building android or whatever. The 2 links I provided to YouCompleteMe and lucianofiandesio are very detailed and should suit your needs. I basically have 1 libgdx project with the android/ios/desktop in one folder and run the :CreateProject inside there.Savoirvivre
I got about build command but still confused in :CreateProject. Should I consider all models as a single project and use :CreateProject in parent folder. Or I need to do it in all three(android/ios/desktop) modules separately.Lutes
I ran it in the base folder and everything seems to work fine.Savoirvivre
@HinesBourne Did yoy manage to get the auto-completation and validation working?Gramarye
Yes, Jesus. I followed both YouCompleteMe and lucianofiandesio.com/vim-configuration-for-happy-java-coding and was able to get it working.Savoirvivre
I've been working on this as well. I am finding I need to import my project and use 'build model' within the Eclipse UI. Once that is done, I can kill eclipse UI and start eclimd, and everything works as expected including :JavaImportOrganize. I'm working now on doing the import and build model from the command line, so I never have to open Eclipse.Psalmist
P
2

I am able to get most or all Eclim functionality working with my libgdx project this way:

  • create a new libgdx project with their tools
  • start Eclipse
  • Import --> Gradle Project --> Build Model per usual libgdx project creation
  • shut off Eclipse, start Eclim

I get organize imports, java validation, autocompletion, all the good stuff.

That said, I want to figure out how to do this all without having to use Eclipse. I think the missing piece is the Build Models functionality. Still researching ...

Psalmist answered 10/1, 2015 at 16:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.