0

I am trying to run JDepend plugin via gradle. I have following jdepend.gradle file:

apply plugin: 'jdepend'

// Repository definition to get JDepend libraries.
repositories {
    mavenCentral()
}

jdepend.reportsDir = file("${reporting.baseDir}/jdepend-output")

jdependMain {
    reports {
        text {
            enabled = 'true'
            destination = file("${jdepend.reportsDir}/jdepend.txt")
        }
        xml {
            enabled = !text.enabled
        }
    }
}

When I try to run build I have following error:

gradle build -x test --parallel

Parallel execution with configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

  • Where: Script 'C:\Drive D\Dev\project\projectName\gradle\jdepend.gradle' line: 10

    • What went wrong: A problem occurred evaluating script. Could not find method jdependMain() for arguments [jdepend_1dpftayagd693nuav7nmwvyci$_run_closure2@45128c37] on root project 'projectName' of type org.gradle.api.Project.

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.834 secs

Could you please help me to understand what's wrong? Thanks.

Regards, Sergii

Sergii Sopin
  • 411
  • 2
  • 11

1 Answers1

0

I was applying JDepend plugin to the main project and it was the problem. I needed to apply it to all sub-projects instead.

Sergii Sopin
  • 411
  • 2
  • 11
  • Could you be a bit more specific in how you fixed the error please? – friederbluemle Jun 16 '17 at 15:02
  • I have a multi project build. So, instead of applying this plugin to a main project (like, to a whole gradle.build file) I had to do it for all sub-projects. Something like this: `def projectsWithArtifacts() { return subprojects.findAll { it.name.equals('webapp') || it.name.equals('core') } } configure(projectsWithArtifacts()) { apply from: "$rootProject.projectDir/gradle/jdepend.gradle" } ` – Sergii Sopin Jun 17 '17 at 18:26