Search code examples
javamavengradleintellij-idea

How to remove Maven build options (in IntelliJ only) from a project that uses both Maven and Gradle?


I have opened a project that is going through a transition from Maven to Gradle. I have accidentally confirmed I want to open it as both Maven and Gradle project, but in reality I want to build with gradle only.

In the right side of IntelliJ, I now see Maven and Gradle tabs. And it is not clear what is being used when I click build. When I go to Build menu, I can see a "Select build variant..." option. When I click it, nothing happens.

How to select which build system should be used by IntelliJ on an existing project? I don't want to remove any configuration files, I just want IntelliJ to ignore the build system I don't want to use.


Solution

  • It is actually very easy, I just didn't see it until a colleague showed me.

    In the Maven tab on the right, right-click every project and select "Unlink Maven Project". After you do that for all of them, the Maven tab will be gone and selecting Build will only start Gradle builds (if you have them).

    Here is a screenshot with Gradle, for Maven it looks the same:

    enter image description here