-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
I configured CPD for my multi-project Gradle 6.5.1 project. Some of these sub-projects make use of the java-test-fixtures plugin, which allows me to put Java files into src/testFixtures/java
. Despite limiting the source
as shown below, I get a CPD issue for code inside src/testFixtures/java
(both files which are part of the issue are inside the same directory).
With --debug
I see the tokenize
debug message for the files in source/main/java
, followed by those in source/testFixtures/java
:
2020-07-10T10:29:58.078+0100 [DEBUG] [de.aaschmid.gradle.plugins.cpd.internal.worker.CpdExecutor] Tokenize /home/cotto/IdeaProjects/xxx/yyy/src/main/java/com/aaa/Logs.java
2020-07-10T10:29:58.078+0100 [DEBUG] [de.aaschmid.gradle.plugins.cpd.internal.worker.CpdExecutor] Tokenize /home/cotto/IdeaProjects/xxx/yyy/src/testFixtures/java/com/bbb/DatabaseLockingTestJob.java
However, when I debug the source
property in my configuration, everything is fine (i.e. I only see src/main/java
files):
files(source).each { File file ->
println(file)
}
This happens with:
source = files('src/main/java')
source = sourceSets.main.java
source = sourceSets.main.allJava
plugins {
id 'de.aaschmid.cpd' version '3.1' apply false
}
configure(subprojects.findAll { it.name != 'xxx-platform' }) {
apply plugin: 'java'
apply plugin: 'de.aaschmid.cpd'
check.dependsOn(cpdCheck)
cpdCheck {
source = files('src/main/java') // do not run for test code
}
}