xvik / gradle-quality-plugin

Gradle quality plugin for Java and Groovy
http://xvik.github.io/gradle-quality-plugin
MIT License
134 stars 11 forks source link

Error: Could not get unknown property 'groovy' #13

Closed sebastianhaeni closed 5 years ago

sebastianhaeni commented 5 years ago

I'm getting the following error in our project:

Could not get unknown property 'groovy' for source set 'main' of type org.gradle.api.internal.tasks.DefaultSourceSet.

groovy.lang.MissingPropertyException: Could not get unknown property 'groovy' for source set 'main' of type org.gradle.api.internal.tasks.DefaultSourceSet.
    at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:83)
    at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:61)
    at org.gradle.api.internal.tasks.DefaultSourceSet_Decorated.getProperty(Unknown Source)
    at ru.vyarus.gradle.plugin.quality.report.ReportUtils.extractJavaPackage(ReportUtils.groovy:33)
    at ru.vyarus.gradle.plugin.quality.report.ReportUtils$extractJavaPackage$0.call(Unknown Source)
    at ru.vyarus.gradle.plugin.quality.report.PmdReporter$_report_closure1$_closure2.doCall(PmdReporter.groovy:33)
    at ru.vyarus.gradle.plugin.quality.report.PmdReporter$_report_closure1.doCall(PmdReporter.groovy:30)
    at ru.vyarus.gradle.plugin.quality.report.PmdReporter.report(PmdReporter.groovy:19)
    at ru.vyarus.gradle.plugin.quality.QualityPlugin$_applyReporter_closure10.doCall(QualityPlugin.groovy:321)

It seems to be related to this project. And it's correct that there is no groovy source set.

I'm guessing with a simple check, if groovy exists, on this line would fix the bug: https://github.com/xvik/gradle-quality-plugin/blob/9376bd7134d6f33b211297f6626a6d2f4961b221/src/main/groovy/ru/vyarus/gradle/plugin/quality/report/ReportUtils.groovy#L33

xvik commented 5 years ago

New version released

It now uses sourceSets.allJava to check all java-related sources and avoid direct groovy source reference.