15

I'm working on two Java projects: Gradle project and a Maven project with snapshot dependency to the Gradle project.

When I'm changing the gradle project I need to install it to m2 and refresh the dependency in the IntelliJ.

Is there a way to make the gradle project sources be up to date at all time to the maven project without installing it to m2?

Vizllx
  • 9,135
  • 1
  • 41
  • 79
Shikloshi
  • 3,761
  • 7
  • 32
  • 58
  • 5
    The best way I've found so far is in Intellij mark the install task (under the Gradle window) as "Execute After Make". So hitting F9 (make) will automatically install the artifacts to .m2 – shayy May 04 '15 at 13:54
  • 1
    Gradle has recently announced a new version of Gradle that supports continous building. This makes it possible to make the gradle file targets be kept automatically up to date. – Lmickos Aug 01 '15 at 23:02
  • May I ask how do you install gradle project to m2 ? – diginoise Aug 04 '15 at 13:25
  • @diginoise you should add maven plugin ( by adding:"apply plugin: 'maven'" to your build.gradle) and use gradle install task. – Shikloshi Aug 04 '15 at 13:29

1 Answers1

3

You have to in InteliJ:

  • RIGHT CLICK on your Maven project and from the context menu select Open Module Settings (F4)
  • in the right panel select Libraries
  • in the middle panel select green plus (add library)
  • select Java from the drop-down
  • navigate to the main directory of your Gradle project and confirm the selection

voilà!

diginoise
  • 7,352
  • 2
  • 31
  • 39