Groovy / Gradle improvements within IntelliJ #68

Closed
Cervator opened this Issue Jan 28, 2012 · 9 comments

Comments

Projects
None yet
3 participants
Owner

Cervator commented Jan 28, 2012

The Gant build file I created works - from a command prompt. IntelliJ claims to have Gant support, and there are even settings for it. But despite spending some time trying to make it work I had no luck. Would be nice to be able to execute the build targets from within IntelliJ, and even more so making it the default way for IntelliJ to do stuff so we can dump the Ant script!

This may involve more IntelliJ tinkering like defining artifacts (again, we used to have Blockmania artifacts defined) so good research here that can be done completely independent of our code

Edit: rapodaca got us upgraded to Gradle - which also is supposed to work inside IntelliJ, but quick tinkering got no further than with Gant :D

Edit2: So yeah, maybe I should make a new ticket, but.. pile of extras added to the bottom, ticket renamed!

Member

rapodaca commented Feb 25, 2012

Suggest closing this one after Gradle build integration complete.

Owner

Cervator commented Feb 28, 2012

Updated OP - Gradle works now, just needs some tweaks - but I renamed this to figure out how to get Gradle working in IntelliJ now :-)

I guess it works easily in Eclipse?

Owner

begla commented Mar 2, 2012

Works perfectly with IntelliJ. Like it! Can we close that one here?

@ghost ghost assigned Cervator Mar 2, 2012

Owner

Cervator commented Mar 2, 2012

I was hoping for an Ant-like sidebar button that would allow you to easily execute Gradle tasks from within IntelliJ, but since "gradle idea" does configure the minimum needed bits and the Gradle plugin might not actually be at that level yet I can let it go :D

Let me do some doc updates on this topic first and I'll close it with that done

Member

rapodaca commented Mar 3, 2012

There are many ways to customize the idea plugin, according to this:

http://gradle.org/docs/current/userguide/idea_plugin.html

Owner

Cervator commented Mar 3, 2012

I saw that link in the recent past, but somehow missed that the individual config tasks are links... heh

Now that makes a lot more sense and it seems there's some potential to set up some quick additional convenience steps - so going to leave that open until one of us gets a chance to tinker, to for instance set the JDK level to 1.6 (seems to start at 1.5 currently)

I did update the DevSetup bits to include Gradle and the current steps to set SDK, Git integration, and Run config: http://wiki.movingblocks.net/Main/DevSetup

Owner

Cervator commented Mar 10, 2012

Argh - did a giant write-up on this and lost the tab :P

  • Added a bit more to http://wiki.movingblocks.net/Main/JavaDoc on how "gradle javadoc" actually works despite build.gradle not explicitly defining that target
  • Added config to build.gradle to set the default JDK to 1.6 so we don't need to do that manually
  • Sounds doable to set Git as active Version Control via Gradle - but tiny convenience vs needed research
  • Also sounds doable to include a Gradle Wrapper with the codebase, eliminating the need to install Gradle to run from source, which would be nice: http://gradle.org/docs/current/userguide/userguide_single.html#gradle_wrapper
  • Groovy plugin comes bundled with IntelliJ, but some fancy features were split off into a separate Ultimate plugin. Maybe that's where they're hiding the goodies
  • A Groovy facet (that you can add Gradle to) might be exactly what I'm looking for - but my IntelliJ doesn't list ANY facets other than Android at Project Structure / Modules or Facets. Wha? Anybody else see more?
  • You actually CAN run Gradle tasks from IntelliJ, by treating build.gradle as a Groovy script running the specific task (can highlight the task in build.gradle and right click - run, or even press CTRL-SHIFT-F10)
  • Some related changes within IntelliJ may actually be in version 11. That might be why I can't find stuff locally yet can find references online

Also, yeah, we need to pretty up some javadoc to avoid a pile of warnings :D

Edit: Oh yeah, forgot, there also IS an explicit "Gradle GUI" plugin, but it doesn't seem to currently work, probably because it was based on the old united "JetGroovy" plugin ... https://github.com/gradle/gradle-intellij-gui/wiki/

Cervator added a commit that referenced this issue Mar 10, 2012

More work on #68, can't resist. Adds the Gradle Wrapper so users can …
…run from source without first installing Gradle
Owner

Cervator commented Mar 10, 2012

Okay, so I'm not able to let this go quite yet :P

I somehow got the Gradle GUI working, after setting the GRADLE_HOME inside IntelliJ and IDEA_JDK outside IntelliJ (env var). I can now run Gradle tasks via GUI inside IntelliJ and it works - yay!

The new gradlew branch has the latest. One remaining issue is that GRADLE_HOME for IntelliJ config isn't set in the generated project files, which possibly could be done automatically or via override in the Gradle GUI plugin setting (which can use gradlew), but Gradle GUI isn't visible until after GRADLE_HOME is set.... chicken & egg situation :-(

Also found a Groovy DSL thingie for IntelliJ: http://confluence.jetbrains.net/display/GRVY/Scripting+IDE+for+DSL+awareness

Owner

Cervator commented Mar 30, 2012

Like Kai pointed out over at http://board.movingblocks.net/viewtopic.php?p=1515#p1515 you can replace the default viewer and merge tool for Git with alternatives of your choice, like P4Merge ("External Merge and Diff Tools" here: http://progit.org/book/ch7-1.html)

I love P4Merge and started looking into doing that... but it is a bit more involved than I thought at first to do it right ;-) I expect we could do a Gradle task that uses a few version controlled scripts (in the Gradle wrapper dir) to set everything up for the user.

@Cervator Cervator closed this Oct 29, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment