# Build File Basics

version 8.13

Generally, a build script details build configuration, tasks, and plugins.

Every Gradle build comprises at least one build script.

In the build file, two types of dependencies can be added:

1. The libraries and/or plugins on which Gradle and the build script depend.

2. The libraries on which the project sources (i.e., source code) depend.

## Build scripts

The build script is either a `build.gradle` file written in Groovy or a `build.gradle.kts` file in Kotlin.

The Groovy DSL and the Kotlin DSL are the only accepted languages for Gradle scripts.

Let’s take a look at an example and break it down:

build.gradle.kts

    plugins {
        id("application")               (1)
    }

    application {
        mainClass = "com.example.Main"  (2)
    }

1 | Add plugins.
2 | Use convention properties.

build.gradle

    plugins {
        id 'application'                (1)
    }

    application {
        mainClass = 'com.example.Main'  (2)
    }

1 | Add plugins.
2 | Use convention properties.

### 1. Add plugins

Plugins extend Gradle’s functionality and can contribute tasks to a project.

Adding a plugin to a build is called applying a plugin and makes additional functionality available.

    plugins {
        id("application")
    }

The `application` plugin facilitates creating an executable JVM application.

Applying the Application plugin also implicitly applies the Java plugin. The `java` plugin adds Java compilation along with testing and bundling capabilities to a project.

### 2. Use convention properties

A plugin adds tasks to a project. It also adds properties and methods to a project.

The `application` plugin defines tasks that package and distribute an application, such as the `run` task.

The Application plugin provides a way to declare the main class of a Java application, which is required to execute the code.

    application {
        mainClass = "com.example.Main"
    }

In this example, the main class (i.e., the point where the program’s execution begins) is `com.example.Main`.

Consult the Writing Build Scripts page to learn more.

Next Step: Learn about Dependency Management >>