I have a library in one project and an app in a separate project. I’m trying to use --include-build so that my app will pickup changes I make to the library. I can build the library fine on its own, but when I try to include the library with --include-build it fails.
In my library I have moved all my test coverage related groovy code to its own file. I apply this in the build.grade file with this line:
apply from: file('./gradle/test-quality.gradle')
I use this command to run my app:
./gradlew --include-build ../my-library --debug my-app:bootRun
However, that results in the below exception related to my test gradle file. Based on the error I really don’t know how to resolve this. Any suggestions?
15:54:25.454 [INFO] [io.spring.gradle.dependencymanagement.internal.DependencyManagementApplier] Applying dependency management to configuration ‘jacocoAgent’ in project ‘my-library’
15:54:25.455 [INFO] [io.spring.gradle.dependencymanagement.internal.DependencyManagementApplier] Applying dependency management to configuration ‘jacocoAnt’ in project ‘my-library’
15:54:25.462 [DEBUG] [org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated] Applying Jacoco to test
15:54:25.481 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Project : - Registering model element ‘tasks.jacocoTestReport’ (hidden = false)
15:54:25.492 [DEBUG] [org.gradle.configuration.project.BuildScriptProcessor] Timing: Running the build script took 1.427 secs
15:54:25.504 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
15:54:25.504 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
15:54:25.504 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
15:54:25.504 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
15:54:25.504 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Script ‘/Volumes/HomeDir/Users/adhamh/rio/my-library/gradle/test-quality.gradle’ line: 7
15:54:25.504 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
15:54:25.505 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
15:54:25.505 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred evaluating script.
15:54:25.505 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not find method jacocoTestCoverageVerification() for arguments [test_quality_dbx60iba9wchakwvls8vpuh9q$_run_closure2@18dbc65b] on project ‘:my-library’ of type org.gradle.api.Project.
15:54:25.505 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
15:54:25.505 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
15:54:25.505 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
15:54:25.505 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger]
15:54:25.505 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED
15:54:25.505 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger]
15:54:25.506 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] Total time: 2.603 secs
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method jacocoTestCoverageVerification() for arguments [test_quality_dbx60iba9wchakwvls8vpuh9q$_run_closure2@5b66c5a8] on project ‘:my-library’ of type org.gradle.api.Project.
at org.gradle.internal.metaobject.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:182)
at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:167)
at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:83)
at test_quality_dbx60iba9wchakwvls8vpuh9q.run(/Volumes/HomeDir/Users/adhamh/rio/my-library/gradle/test-quality.gradle:7)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
… 84 more