Gradle Groovy Plugin

From NovaOrdis Knowledge Base
Revision as of 07:17, 28 March 2021 by Ovidiu (talk | contribs) (→‎TODO)
Jump to navigation Jump to search

External

Internal

Overview

The Groovy plugin introduces a new "groovy" source set, and its corresponding compilation tasks "compileGroovy", "compileTestGroovy", similar to compileJava and compileTestJava. Similarly to the Java plugin, which builds upon a Java Base plugin, the Groovy builds upon a Groovy Base plugin. The Groovy plugin automatically applies the Java plugin as well, which means that the project contains a source set for Java sources, and anything else the Java plugin provides. This does not mean that Java sources are required to be present in the project.

plugins {
    id 'groovy'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.codehaus.groovy:groovy-all:3.0.7'
}

The project follows the conventions introduced by the Java plugin:

.
└─ src
    ├─ main
    │   ├─ java
    │   ├─ groovy
    │   └─ resources
    └─ test
        ├─ java
        ├─ groovy
        └─ resources

Customization

The location of the source file directories can be changes reconfiguring source set in the same way it is done for the Java plugin:

Java_Plugin | Source Set Customization