How to Create a Gradle Project in IntelliJ IDEA?
Last Updated :
26 Jun, 2022
Gradle is an excellent open-source construction tool that is capable of the development of any kind of software. It is an automation tool that is based on Apache Ant and Apache Maven. This tool is capable of developing applications with industry standards and supports a variety of languages including Groovy, C++, Java, Scala, and C. Gradle also is capable of controlling the development tasks from compilation and packaging to testing, deployment, and publishing. Read more about Gradle here, Introduction to Gradle.
In this article, we are going to explain how to create a Gradle project in IntelliJ IDEA. IntelliJ is an integrated development environment(IDE) written in Java. It is used for developing computer software. This IDE is developed by Jetbrains and is available as an Apache 2 Licensed community edition and a commercial edition.
Prerequisite: Refer to this article and install IntelliJ IDEA on your local machine: Step by Step guide to install Intellij Idea
Step By Step Implementation
Step 1: Open your IntelliJ IDE, and go to the File > New > Project as shown in the below image.
 Step 2: On the next screenÂ
- Name: Provide a suitable name as per your requirementÂ
- Location: Choose the location you want to store your project
- Language: Choose the programming language as per your requirementÂ
- Build System: Here you have to choose Gradle
- Gradle DSL: Simply, it stands for 'Domain-Specific Language'. In the Gradle context, DSL gives you a Gradle-specific way to form your build scripts. Here you can choose Groovy or Kotlin as per your requirement.
- JDK: Choose the JDK you want to use
And if you check the "Add sample code" box then a simple Main class will be generated with the main() method inside. And if you open the Advance setting then you can also modify your GroupId and ArtifactId as shown in the below image.Â
- GroupId: a unique base name of the company or group that created the project
- ArtifactId: a unique name of the project
And finally, click on the Create button. And you are done.Â
 After successfully creating the project you can see there are two default files have been created.Â
build.gradle file:
plugins {
id("java")
}
group = "org.gfg"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
}
tasks.getByName<Test>("test") {
useJUnitPlatform()
}
Main.java class:
Java
package org.gfg;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
Refer to the below image.Â
Â
Similar Reads
How to Create a Maven Project in IntelliJ IDEA? Maven is a powerful project management tool based on POM (project object model). It is used for project build, dependency, and documentation. It simplifies the build process like ANT. In the short term, we can tell Maven is a tool that can build and manage any Java-based project. maven makes the day
4 min read
How to Create a Maven Project in Eclipse IDE? Maven is a powerful project management tool that is based on POM (project object model). It is used for project build, dependency, and documentation. It simplifies the build process like ANT. But it is too much advanced than ANT. In short terms we can tell maven is a tool that can be used for buildi
2 min read
How to Add External JAR File to an IntelliJ IDEA Project? IntelliJ is an integrated development environment(IDE) written in Java. It is used for developing computer software. This IDE is developed by JetBrains and is available as an Apache 2 licensed community edition and a commercial edition. Please refer to this article step by step guide to install Inte
2 min read
How to Create a Project In NetBeans GUI? All Java Development in the IDE takes place within Projects, we first need to create a new project within which to store sources and other project files. An IDE project is a group of JAVA Source files plus its associated metadata (data about data), including project-specific properties files, and ma
2 min read
How to Create a Spring Boot Project with IntelliJ IDEA? Spring Boot is one of the most popular frameworks for building Java applications, and IntelliJ IDEA is a top-tier IDE for Java development. In this article, we will guide you through the process of creating a Spring Boot project using IntelliJ IDEA. Whether you are a beginner or an experienced devel
3 min read