apply plugin: 'java'

task show << {
    // Access the convention property as a project property
    println relativePath(sourceSets.main.output.classesDir)
    println relativePath(project.sourceSets.main.output.classesDir)

    // Access the convention property via the convention object
    println relativePath(project.convention.plugins.java.sourceSets.main.output.classesDir)
}
