Questions tagged [gradle]

Gradle is a project build automation tool that uses a Groovy DSL. Gradle build scripts support Maven and Ivy repositories as well as plain file system for dependency management.

Gradle is a build automation tool focused on flexibility and performance. Gradle build scripts are written using a or DSL. Gradle allows the use of , , or user-defined repositories for dependency management.

Why Gradle?

  • Polyglot Builds: build in 60 different programming languages
  • Tool Integration: like , , , etc.
  • Robust Dependency Management
  • Powerful Yet Concise Logic: declarative and imperative
  • High Performance Builds
  • Build Reporting

Gradle allows you to describe the automation of a project build both declaratively and imperatively as you have the full power of the programming language to describe Gradle tasks.

There are many plugins for Gradle. Both native ones like the "War" plugin and third-party ones. These can be found at plugins.gradle.org

Latest Version: 7.6 (Nov 25, 2022)

The default name for the build script is build.gradle

Expressing a project dependency

repositories {
    mavenCentral()
}

dependencies {
    testCompile 'junit:junit:4.12'
}

Defining a task

Using a closure in defining a task count action:

task count {
    doFirst {
        4.times { print "$it " }
    }
}

Output of running gradle -q count:

> gradle -q count
0 1 2 3

Links:

Related tags:

Tips:

51043 questions
22
votes
2 answers

Resolve findBugs issue in gradle

Overview: I am trying to upgrade Java and Gradle version in my project as follows: java from 8 to 11 Gradle from 5 to 6 My project runs with no issues on the old versions but when runs on Java 11 and Gradle 6 it complains about fireBugs plugin…
saeedj
  • 2,179
  • 9
  • 25
  • 38
22
votes
7 answers

Slow gradle build in Docker. Caching gradle build

I am doing university project where we need to run multiple Spring Boot applications at once. I had already configured multi-stage build with gradle docker image and then run app in openjdk:jre image. Here is my Dockerfile: FROM…
PAwel_Z
  • 329
  • 1
  • 2
  • 5
22
votes
6 answers

Gradle > Task :app:generateSafeArgsDebug FAILED

I have a kotlin project and i used Navigation component. in my local machine i can use gradle build and it's work ok. but in my remote ubuntu when i call gradle build i get this message can anyone help me root@sarvdata:/home/test2/WooShop# gradle…
morteza jafari
  • 270
  • 2
  • 12
22
votes
8 answers

IntelliJ/Gradle Could not determine java version from '11.0.1'

I'm running a Linux Ubuntu 18 OS. Installed jdk in a custom local directory. Normally, IntelliJ recommends that you use the default gradle wrapper. But in my case, I want to be able to change the Gradle Version on the fly whenever it's due for an…
S34N
  • 7,469
  • 6
  • 34
  • 43
22
votes
2 answers

Android Studio not showing java class source

I've searched this question and tried the proposed solutions with no success. I have a project which when I go to view the source file for lets say Fragment it takes me to the java class just fine. Now when I go to File -> new project and go through…
Kyle
  • 695
  • 6
  • 24
22
votes
4 answers

"Starting Gradle daemon" loop creating endless processes

Whenever I open or create a project in Android Studio, and it starts to do its background build or whatever, it gets to "Starting Gradle daemon", but gets in a loop and never stops repeating that step. As a result, the build never finishes and it…
flarn2006
  • 1,787
  • 15
  • 37
22
votes
7 answers

Android Gradle Sync failed could not find support-core-ui.aar

I've been working on this Android Project for about a year now, suddenly when I opened it yesterday Android Studio 3.1.2 failed to sync gradle and the project doesn't build anymore giving me this error: Could not find support-core-ui.jar…
22
votes
3 answers

Failed to resolve: play-services-flags

Today, Android Studio stopped to sync properly due to configuration issues. Could not resolve all files for configuration ‘:app:providerRepositoryDebugCompileClasspath’. Could not find firebase-analytics-impl.aar…
vanste25
  • 1,754
  • 14
  • 39
22
votes
6 answers

Android Studio maven { url "https://jitpack.io" } can't download

Can't use anymore maven { url "https://jitpack.io" }. I have following gradle: apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applicationId "test.com.myapplication" minSdkVersion 19 …
Choletski
  • 7,074
  • 6
  • 43
  • 64
22
votes
2 answers

Cannot resolve external dependency org.springframework.boot:spring-boot-starter: because no repositories are defined

I have a multibuild project and I am currently just setting it up. Each module naturally each has a gradle.build file that only contains the following: dependencies { } In the main build.gradle file I have want is needed for every module. However…
Mike3355
  • 11,305
  • 24
  • 96
  • 184
22
votes
2 answers

How to add more build types in app than library

Just like the example here I am extending my build types to add staging: android { buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' …
weston
  • 54,145
  • 21
  • 145
  • 203
22
votes
1 answer

Android Libraries: maven vs maven-publish gradle project

I'm building a large multi-module Android library, and need to publish the library to an internal company Artifactory. Should I use the old maven plugin, or the new maven-publish plugin? Note: The above two official plugins don't fully support…
ZakTaccardi
  • 12,212
  • 15
  • 59
  • 107
22
votes
12 answers

Could not resolve com.android.tools.build.gradle:3.0.1

I'm forcing gradle to use http I have modified my gradle-wrapper.properties: distributionUrl=http\://services.gradle.org/distributions/gradle-4.3-all.zip The build.gradle: buildscript { repositories { //jcenter() //google() maven { url…
kol23
  • 1,498
  • 3
  • 16
  • 35
22
votes
5 answers

Building a Kotlin + Java 9 project with Gradle

I'm fairly new to Gradle (and Java 9, to be honest), and I'm trying to use Gradle to build a simple library project that is a mix of Java 9 and Kotlin. More in detail, there is an interface in Java and an implementation in Kotlin; I'd do everything…
Germano Rizzo
  • 481
  • 1
  • 3
  • 8
22
votes
1 answer

Alpha, Beta, Snapshot, Release, Nightly, Milestone, Release Candidate(RC)... When to use which terminology

As a build, release and deployment engineer, there are multiple types of releases as below: Alpha Beta Snapshot Release Nightly Milestone Release Candidate(RC) [Anything else] Would like to know the difference between them and the…
vijayinani
  • 2,548
  • 2
  • 26
  • 48