Skip to content

Gradle

Gradle is an open-source build automation system that builds upon the concepts of Maven and introduces a Groovy-based domain-specific language. It supports incremental builds by intelligently determining which parts of the build tree are up to date; any task dependent only on those parts does not need to be re-executed. (source)

Convention over configuration

Convention over configuration attempts to decrease the number of decisions that a developer using the framework is required to make without necessarily losing flexibility. Gradle accomplishes this through a flexible build definition from the build.gradle instructions file.

Flexibility

Gradle is modeled in a way that is extensible in the most fundamental ways. Gradle's model also allows it to be used for native development and can be expanded to cover any ecosystem. It can solve many automation scenarios and is built with an empowered and responsible user in mind.

Tasks and build.gradle

Gradle provides APIs for creating and configuring tasks through a Groovy DSL. A Project includes a collection of Tasks, each of which performs some basic operation. Gradle comes with a library of tasks that you can configure in your own projects.

plugins {
    id 'org.springframework.boot' version '2.2.2.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

repositories {
    // url 
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

task copyReport(type: Copy) {
    from file("$buildDir/reports/my-report.pdf")
    into file("$buildDir/toArchive")
}