Reputation: 754
I have a very basic java project.
In Eclipse there is an option to convert a project to a maven project all you have to do is right click on the java project and click "Convert to Maven Project". So basically it creates a pom.xml file for you.
Does IntelliJ have a similar command to convert to Gradle? Searched around but it did not seem like it does.
Upvotes: 29
Views: 43633
Reputation: 143
Convert a regular project into a Gradle project
example:
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
}
As soon as you create a build.gradle file, IntelliJ IDEA recognizes the Gradle build script and displays a notification suggesting to load the project as Gradle. After you load the project, IntelliJ IDEA enables the Gradle tool window.
From: https://www.jetbrains.com/help/idea/gradle.html#convert_project_to_gradle
Upvotes: 8
Reputation: 975
Close your project (you may want to commit first)
Select "New Project"
Select Gradle (and any other frameworks you need)
Enter the directory where the Idea project to be converted is and click "Finish"
Idea should handle the rest, you may need to move your files into main/java (etc)
I don't think there's a simple way to do this in place.
Upvotes: 2
Reputation: 786
The simple way to migrate from Maven to Gradle via Intellij IDEA is:
gradle init
. Wait until the building process ends and then save & close your project.Upvotes: 48