I am currently trying to get the CodeNarc plugin for Gradle 8.0.2 to work in my project.
Due to some reasons, the Groovy files have different extensions. At the moment, the plugin only seems to run for the *.groovy
files.
Let's say I have a build.gradle
file like this:
plugins {
id 'groovy'
id 'java'
id 'codenarc'
}
repository {
mavenCentral()
}
dependencies {
implementation 'org.apache.groovy:groovy-all:4.0.10'
}
sourceSets {
main {
groovy {
srcDirs = ['directory1', 'directory2']
}
}
}
Now I have the following files:
directory1/utils.groovy
directory1/something.groovy
directory2/another.myextension
Running ./gradlew codenarcMain --info
will not print:
No matching files found for FileSet with basedir [/home/path/to/project/directory2]
Adding
codenarcMain {
include('**/*.myextension', '**/*.groovy')
}
does not seem to change anything.
What is the correct approach to register custom extensions for the CodeNarc plugin from within Gradle?