Bkauf Bkauf - 1 year ago 87
Java Question

Gradle Plugin Duplicate Version Artifactory Search

I am trying to apply a plugin on a project that is a company specific findbugs plugin. In my Parent gradle project I have the following:

dependencies {
findbugs 'com.google.code.findbugs.findbugs:3.0.1'
findbugs configurations.findbugsPlugins.dependencies
// Here we specify the findbugsPlugins
findbugsPlugins 'com.company.common.company-findbugs-plugin:1.01'
}
task findbugs(type: FindBugs) {
classes = fileTree(project.rootDir.absolutePath).include("**/*.class");
source = fileTree(project.rootDir.absolutePath).include("**/*.java");
classpath = files()
pluginClasspath = project.configurations.findbugsPlugins
findbugs {
toolVersion = "3.0.1"
sourceSets = [sourceSets.main]
ignoreFailures = true
reportsDir = file("$project.buildDir/findbugsReports")
effort = "max"
reportLevel = "high"
includeFilter = file("$rootProject.projectDir/include.xml")
excludeFilter = file("$rootProject.projectDir/exclude.xml")
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
}


However, when I build the project, the build fails with an exception reporting:

Could not resolve all dependencies for configuration ':findbugsPlugins'.
> Could not find com.company.common.company-findbugs-plugin:1.01:.
Searched in the following locations:

http://artifactory.company.com:8081/artifactory/repo/com/company/common/company-findbugs-plugin/1.01//1.01-.pom
http://artifactory.company.com:8081/artifactory/repo/com/company/common/company-findbugs-plugin/1.01//1.01-.jar
Required by:
com.company.project:ProjectName1.0.4


Any reason why gradle is adding the version twice at the end of the path?

Answer Source

You have incorrectly defined the Gradle dependency, colon is missing between GroupId and ArtifactId:

'com.google.code.findbugs:findbugs:3.0.1'

and the same most likely applies for

'com.company.common:company-findbugs-plugin:1.01'