Get the source of the project source in the Gradle plugin

First of all, sorry if I missed this in the documentation somewhere.

I am trying to write a Gradle plugin in Java.

In particular, I need to do this:

public class MyPlugin implements Plugin<Project>{

    @Override
    public void apply(Project project) {
        project.getSourceDir();
    }
}

In other words, how can I, if possible, get the directory where my plug-in project resources are located?

I proceed from my assumption that when the apply method gets called Gradle will already know where the sources are, and this location can not further change?

Thank.

+4
source share
2 answers

, . , apply.

+1

Gradle.

"sourceSet", "project.sourceSets". sourceSet .

DSL, , . "SourceSet".

0

All Articles