Gradle - Getting Started

About

How to get a minimal project to start with gradle

Steps

Installation

Create a Project

Create a project

  • with gradle init (preferred)
  • or with idea

Gradle init

This method is the preferred one because you get the whole structure (if you choose that you will create an application, you get a minimal main entry and all the plugins needed)

mkdir myproject
cd myproject
gradle init
  • Select the type:
    • 1: will not have language specific configuration - You get a blank project that is not tailored to your language
    • 2 and 3: will have language specific configuration
Select type of project to generate:
  1: basic
  2: application
  3: library
  4: Gradle plugin
Enter selection (default: basic) [1..4] 2
  • Then choose your language
Select implementation language:
  1: C++
  2: Groovy
  3: Java
  4: Kotlin
  5: Swift
Enter selection (default: Java) [1..5] 3
Select build script DSL:
  1: Groovy
  2: Kotlin
Enter selection (default: Groovy) [1..2] 2
  • Then the test framework
Select test framework:
  1: JUnit 4
  2: TestNG
  3: Spock
  4: JUnit Jupiter
Enter selection (default: JUnit 4) [1..4]
  • and the name of the project
Project name (default: myProject):
  • The source package
Source package (default: directoryName): com.gerardnico.myproject

> Task :init
Get more help with your project: https://guides.gradle.org/creating-new-gradle-builds

It creates:

With Idea

You get less artifact than gradle init

  • Idea > File > New Project

_


Powered by ComboStrap