Is it possible to access project properties in EclipseModel?


(Raj Oz) #1

I would like to fine tune the .project file generated by the Eclipse plugin for Gradle. I don’t know whether this is possible as I have not found any examples doing so yet.

In build.gradle

eclipse {
    // Create resource filters in Eclipse .project file to exclude Gradle build directory.
    project.file.withXml { provider ->
         // I would like to use the property "project.buildDir" to create a resource filter.
        // "project" here will refer to eclipse.project not the project being built, hence
        }
}

Attempting to use project.buildDir will result in the following error: Could not find property ‘buildDir’ on org.gradle.plugins.ide.eclipse.model.EclipseProject_Decorated@5aa0ce13.


(Benjamin Muschko) #2

If you have a single-project build you could use rootProject which references the project itself. Alternatively, you can get a reference to the project via the path.