Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to split build.gradle file into files with smaller tasks [duplicate]

Tags:

java

gradle

My build file is big and hard to maintain, how to split the build file into separate files with smaller tasks to be imported into the main gradle file

like image 707
ir2pid Avatar asked Jul 27 '16 12:07

ir2pid


People also ask

How do I run a clean build in Gradlew?

To run a Gradle command, open a command window on the project folder and enter the Gradle command. Gradle commands look like this: On Windows: gradlew <task1> <task2> … ​ e.g. gradlew clean allTests.

Why are there multiple build Gradle files?

Android Studio projects contain a top-level project Gradle build file that allows you to add the configuration options common to all application modules in the project. Each application module also has its own build. gradle file for build settings specific to that module.

Can you have multiple build Gradle files?

gradle for one project? Yes. You can have multiple build files in one project.


1 Answers

build.gradle

apply from: 'other.gradle'

other.gradle

println "configuring $project"
task hello << {
    println 'hello from other script'
}

Output of gradle -q hello

> gradle -q hello
configuring root project 'configureProjectUsingScript'
hello from other script

Source: Configuring the project using an external build script

like image 179
Rudziankoŭ Avatar answered Oct 06 '22 22:10

Rudziankoŭ