How to create Gradle Multi-Project in IntelliJ


In this tutorial, we will take a look at how to create a Multi-Project in IntelliJ,

Step 1: Open IntelliJ IDE

Step 2: Menu: File -> New -> Project...

Make sure you choose Gradle Java Project, we will create a project with the name multi-proj-demo

New Gradle Project IntelliJ
Multi Project Name

Step 3: Menu: File -> New -> Module...

Again make sure you select Gradle and Java Project, we will call this module as utils,

Thats it, now you have a muti-project Gradle Java Project,

setting.gradle
rootProject.name = 'multi-proj-demo'
include 'utils'
build.gradle
plugins {
    id 'java'
}

group 'org.example'
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'
}

test {
    useJUnitPlatform()
}
Build
> Task :compileJava NO-SOURCE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :compileTestJava NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
> Task :utils:compileJava
> Task :utils:processResources NO-SOURCE
> Task :utils:classes
> Task :utils:compileTestJava NO-SOURCE
> Task :utils:processTestResources NO-SOURCE
> Task :utils:testClasses UP-TO-DATE

Top Hashtags:

Advertisements

Advertisements




Advertisements