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
1 answer

Gradle compile dependency is not added to classpath

I've added the reflections framework to my android project. However it wasn't added to the classpath. Android Studio suggests that I need to add it manually, however I cannot start my app since gradle cannot build it. Here is the build.gradle of my…
mvieghofer
  • 2,846
  • 4
  • 22
  • 51
22
votes
4 answers

Grails 3 and Spring Security Plugin

I've just recently started working with Grails, and I'd like to test out the Spring Security Plugin. I'm using Grails v3.0.0RC2, and I'm finding it difficult to come across accurate documentation for it with a lot of things. I'm looking at the…
ekbarber
  • 588
  • 1
  • 4
  • 9
22
votes
4 answers

IntelliJ 14.1 logging output in xml

We use slf4j with logback, when running from the command line this still works as expected but within intellij it's different. Running junit tests using gradle in intellij, log output is in the following xml format:
martin treurnicht
  • 1,223
  • 1
  • 10
  • 17
22
votes
3 answers

Run JUnit test in IntelliJ IDEA 14 without choosing configuration type

In IntelliJ IDEA 14 with Gradle plugin I would like to run JUnit test without being asked about configuration type. Problem occurs when I run test for the first time - there is no configuration for this run. I never run tests with Gradle in IDE so…
Marcin
  • 1,469
  • 14
  • 23
22
votes
1 answer

Jersey RESTful web service gradle setup

I am stuck with creating a gradle project for a RESTful web service using the jersey library. The project configuration should be capable of launching the service inside a jetty application server. I already found a resource:…
ruabmbua
  • 393
  • 1
  • 3
  • 13
22
votes
6 answers

After update - crash com.google.android.gms:play-services:5.2.8

my dependencies: compile "com.android.support:appcompat-v7:20.+" compile 'com.google.android.gms:play-services:5.2.08' compile 'com.android.support:support-v4:21.0.+' but still: Google Play services out of date. Requires 5208000 but found…
Kamil Nękanowicz
  • 6,254
  • 7
  • 34
  • 51
22
votes
3 answers

Import an eclipse android project with version control system into Android Studio

I am trying to import an eclipse project with version control system into Android Studio. Support for direct eclipse project import was added in Android-Studio version "0.5.5" where we don't need to export project first from eclipse to import it…
Shakti Malik
  • 2,335
  • 25
  • 32
22
votes
2 answers

Error:(1, 0) Plugin with id 'android' not found

I have just installed Android Studio and after some quirks about the SDK Build Tools minimum having to be 19.1.0 instead of 19.0.3 I have not came about another error Error:(1, 0) Plugin with id 'android' not found. I haven't found a solution in…
RYU
  • 241
  • 1
  • 2
  • 7
22
votes
5 answers

How to set Gradle `options.bootClasspath` in an os independent manner?

Because my Java sources and targets must be JRE 1.6 compatible, I need to set options.bootClasspath to a path that contains the 1.6 versions of rt.jar and jce.jar. It must build on both Windows and Unix (Linux/Solaris). What is the proper way to do…
Gerrit Brouwer
  • 732
  • 1
  • 6
  • 14
22
votes
1 answer

What commands does Android Studio's `gradle-aware make` perform

Im playing with Android Studio & Gradle and am interesting in what gradle-aware make actually does. The reason for my interest is I was originally under the impression that the default run config for a new AS projects default gradle-aware make runs…
Dori
  • 18,283
  • 17
  • 74
  • 116
22
votes
4 answers

Android studio gradle error with top-level exception

I have recently updated my Android Studio, since then my project does not build...I get errors like the error below: Error Code: 1 Output: UNEXPECTED TOP-LEVEL EXCEPTION: …
Dumbo
  • 13,555
  • 54
  • 184
  • 288
22
votes
1 answer

Gradle deprecation "Relying on packaging to define the extension of the main artifact..." in Android Studio project can be fixed?

I'd like to learn how to use Android Studio at the best, but I still have limited experience especially in building with Gradle. Executing tasks: [clean] Relying on packaging to define the extension of the main artifact has been deprecated and is…
Franco Rondini
  • 10,841
  • 8
  • 51
  • 77
22
votes
3 answers

How Do I Pull Maven Test Jars Using Gradle?

In maven I can specify a "type" for dependency resolution. I am trying to pull down a tests.jar. How can I do this using Gradle? I have tried using the Gradle Dependency below, but this does not pull down test.jar. testCompile(group:…
Rylander
  • 19,449
  • 25
  • 93
  • 144
22
votes
3 answers

How to exclude multiple SLF4J bindings to LOG4J

I am getting the error SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in…
giorgio
  • 2,115
  • 5
  • 23
  • 39
22
votes
2 answers

Disable Gradle auto make in Android Studio

In Android Studio 0.2.0, whenever I type anything in my build.gradle files, Gradle decides it's time to rebuild. This takes a long time, generates noise and kills my battery life. It never ends as well, at least not until I finish editing the file……
davidcesarino
  • 16,160
  • 16
  • 68
  • 109
1 2 3
99
100