Gradle - Build composite

About

composite_build_intro

Type

include

Include the specified build in the composite.

gradle --include-build           

buildSrc

The directory buildSrc is treated as an included build.

The special buildSrc project is built before the main build runs.

Upon discovery of the directory, Gradle automatically compiles and tests this code and puts it in the classpath of your build script.

For multi-project builds there can be only one buildSrc directory, which has to sit in the root project directory.

buildSrc should be preferred over script plugins as it is easier to maintain, refactor and test the code.

├── build.gradle
├── buildSrc
│   ├── build.gradle
│   └── src
│       ├── main
│       │   └── java
│       │       └── com
│       │           └── enterprise
│       │               ├── Deploy.java
│       │               └── DeploymentPlugin.java
│       └── test
│           └── java
│               └── com
│                   └── enterprise
│                       └── DeploymentPluginTest.java
└── settings.gradle

Script Plugin

apply from: 'other.gradle'

Filesystem locations are relative to the project directory

doc





Discover More
Gradle - Build

A build is a lifecyle task that executes a graph of task Gradle executes build scripts in three fixed phases: Initialization: Sets up the environment for the build and determine which projects will...



Share this page:
Follow us:
Task Runner