Issue
I have been happily using IntelliJ + Gradle, but I was recently asked to move to Maven as a build tool. Is there an easy way to convert a Gradle project to Maven in IntelliJ or perhaps keep both configuration files (build.gradle and pom.xml)? As per Gradle build.gradle to Maven pom.xml, I have used the Gradle Maven's plugin and generated the pom.xml file in build/poms, but I would like to keep both build.gradle and pom.xml at the same level providing the ability to build the project using whichever is preferred. Is that possible?
Thanks,
Solution
I can't offer you a solution that lets you keep all your Gradle project settings intact, but if you find the following useful, please mark it accordingly.
To move between the two build tools, you can do the following:
If you have a Maven project, which you want to convert, you need to go into the project folder, and on the cmd line do "gradle init" (obviously make sure Gradle is on your path). Close and reopen the project, and you will be prompted to enable Gradle on the project.
To your exact question, about converting Gradle back to Maven. You can simply delete the .idea folder, leaving all the Gradle scripts in place. Then inside Intellij, select open project. Navigate to your pom.xml and select this. Next through the following screens. When Intellij prompts you to enable the project as Gradle, decline. The result is new project that will still have your Gradle scripts included, but now builds with Maven. You will need to have a valid pom.xml in place that maven can use.
Answered By - wax_lyrical