Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij working with hybrid projects (maven+gradle)

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?

like image 267
Shikloshi Avatar asked Apr 29 '15 15:04

Shikloshi


People also ask

Does IntelliJ use Maven or Gradle?

IntelliJ build uses IDE's own jps project model and builder for compiling the java-based projects. Including incremental build support. With Gradle build it actually uses Gradle to build the project (think Gradle build task).

Can you use Gradle and Maven together?

Short answer: yes. There's no conflict between having two independent build scripts for the same project, one in Maven and one in Gradle.

Does IntelliJ support Gradle?

IntelliJ IDEA supports a fully-functional integration with Gradle that helps you automate your building process. You can easily create a new Gradle project, open and sync an existing one, work with several linked projects simultaneously, and manage them.

How do I change from Maven to Gradle in IntelliJ?

Open your Maven project in Intellij IDEA and then open "Terminal" tab. Write gradle init . Wait until the building process ends and then save & close your project. Reopen your project and click Auto-import, and wait while Gradle is running.


1 Answers

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à!

like image 176
diginoise Avatar answered Oct 16 '22 21:10

diginoise