aaschmid / gradle-cpd-plugin

Gradle plugin to find duplicate code using PMDs copy/paste detection (= CPD).
Apache License 2.0
95 stars 12 forks source link

Cannot resolve external dependency net.sourceforge.pmd:pmd-dist:5.4.2 because no repositories are defined. #33

Closed zenglian closed 5 years ago

zenglian commented 5 years ago

build.gradle

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
}
plugins {
    id "checkstyle"
    id "pmd"
    id "de.aaschmid.cpd" version "1.2"
}

run gradle cpdCheck, got

Cannot resolve external dependency net.sourceforge.pmd:pmd-dist:5.4.2 because no repositories are defined.

zenglian commented 5 years ago

only throw in root project, works in sub modules

jscancella commented 10 months ago

I am running into the same issue with a multi-project setup. How do I run this from the root directory on the subprojects without error?

aaschmid commented 10 months ago

@jscancella without any further information, it is hard for me to provide a solution. The error messages says that there are no repositories defined, have you check that?

I am using it in a multi-project setup and checking cpd in the root directory at junit-dataprovider, see https://github.com/TNG/junit-dataprovider/blob/main/build.gradle.kts. Maybe this might help.

jscancella commented 10 months ago

Yeah I had to add repositories - but what is strange is with other community plugins I didn't need to. Is there a reason you don't package all your dependencies into a single jar and rely on that so that you don't have to specify repositories?

aaschmid commented 10 months ago

Yes, because different people want to use different versions of cpd ;-)

jscancella commented 10 months ago

Interesting. I can change the version in spotbugs but don't need to specify a repository for that plugin. I wonder what they are doing that allows them to be able to do that? Anyways, thank you for the help and a great plugin, please keep up the great work!

aaschmid commented 10 months ago

hm ... maybe I can improve or there is difference between internal and external plugins ;-)

jscancella commented 10 months ago

spotbugs is an external plugin https://github.com/spotbugs/spotbugs-gradle-plugin

aaschmid commented 10 months ago

Right, mixed it up with old FindBugs integrated plugin 🙊

Thanks for the hint, so this could be used as template (if they not just add some repo by default like maven central by default, but some users might prefer using their own proxy artifact repository...)

jscancella commented 10 months ago

yeah, not sure to be honest. But maybe worth a look. Makes the build.gradle a little cleaner as I don't need to specify stuff twice.