Gradle Build Error Evaluating Root Project for org/gradle/internal/metaobject/MethodMixIn - gradle

I've been playing with a legacy project's build script and I get the following error with Gradle 2.13.
myhost jthoms$ gradle clean build
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.13/userguide/gradle_daemon.html.
FAILURE: Build failed with an exception.
* Where:
Build file '/<my-project>/build.gradle' line: 10
* What went wrong:
A problem occurred evaluating root project 'com.mycompany.myorg.myproject'.
> org/gradle/internal/metaobject/MethodMixIn
* 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.494 secs
My build.gradle file looks as follows:
buildscript {
repositories {
maven { url 'http://<my-nexus-repo>/' }
}
dependencies {
classpath 'com.bmuschko:gradle-clover-plugin:2.1.2'
}
}
apply plugin: 'com.bmuschko.clover'
// more build stuff below irrelevant to error line.
My build fails, so how can this error be fixed?
I worked this error out, but I couldn't find anything related to the class mentioned in the error output, so I thought that I would share my finding here.

I found this thread for a similar error. In the thread, #bmuschko recommended upgrading to a newer version of Gradle. For me, upgrading from Gradle version 2.13 to 3.5.1 worked like a charm.

Related

Failed to resolve imported Maven boms: Cannot resolve external dependency

I'm very new to grails and therefore I'm trying to do the following tutorial with IntelliJ: https://guides.grails.org/creating-your-first-grails-app/guide/index.html
After I cloned the repository, the README is asking me to run the following command:
gradle publishGuide
But I get the following error:
sam#sam-USMC:~/IdeaProjects/creating-your-first-grails-app$ gradle publishGuide
Cannot resolve reloading agent JAR: Failed to resolve imported Maven boms: Cannot resolve external dependency org.springframework.boot:spring-boot-dependencies:2.1.9.RELEASE because no repositories are defined.
Required by:
project :complete
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* Where:
Build file '/home/sam/IdeaProjects/creating-your-first-grails-app/complete/build.gradle' line: 19
* What went wrong:
A problem occurred evaluating project ':complete'.
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each([Ljava/lang/Object;Lgroovy/lang/Closure;)[Ljava/lang/Object;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Line 19 of the build.gradle file looks like this:
apply plugin:"org.grails.grails-web"
Grateful for any help!

Plugin with id 'osgi' not found

I am trying to build a project(https://github.com/fge/btf) locally using gradle. There is a plugin "osgi" being used but whenever I build it, I get the error plugin not found. I have tried giving different flavors of OSGi, added the repositories and dependency. Still getting the same error. Please help. Thanks in advance.
FAILURE: Build failed with an exception.
Where:
Build file '/root/btf-1.2/build.gradle' line: 61
What went wrong:
A problem occurred evaluating root project 'btf'.
Plugin with id 'osgi' not found.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
BUILD FAILED in 1s
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.1.1/userguide/command_line_interface.html#sec:command_line_warnings
logs generated are as below
Gradle has discontinued their built-in osgi plugin. Please see the Bnd Gradle plugins.
https://github.com/bndtools/bnd/blob/master/biz.aQute.bnd.gradle/README.md#replacing-use-of-gradles-deprecated-osgi-plugin

gradlew wrapper update to new version error that you have old version

Why gradle build failed:
./gradlew wrapper --gradle-version 6.2
FAILURE: Build failed with an exception.
* Where:
Build file '/home/yburtsev/IdeaProjects/spring-io-testcontainers-workshop/build.gradle' line: 3
* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.2.4.RELEASE']
> Failed to apply plugin [id 'org.springframework.boot']
> Spring Boot plugin requires Gradle 4.10 or later. The current version is Gradle 4.4.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
I manually edit distributionUrl in gradle-wrapper.properties to 6.2 version and than run gradlew wrapper command successfully.
link to project: https://github.com/bsideup/spring-io-testcontainers-workshop
The wrapper task will be run with the previous version of Gradle first. In your case, that is apparently 4.4.1. I don't know why it evaluates the whole project build for the wrapper task, but it does. And since you are using a plugin that is not compatible with that version, it fails.
As you already did, it can be circumvented by editing the file gradle/wrapper/gradle-wrapper.properties manually and set it to the new version. But remember to run the wrapper task again after you did that. This will make it download the new version and use that to update the other wrapper files if needed.
There is a corresponding Github issue for this problem. If you like, you can go put a "thumbs up" on it to give it more attention: https://github.com/gradle/gradle/issues/884.

build error netflix fenzo library

The Netflix fenzo (https://github.com/Netflix/Fenzo) build fails complaining on gradle plugin from netflix not available.
Stack trace below
> Configure project :
Inferred project: fenzo, version: 1.1.0-SNAPSHOT
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/UKHANVA/git/Fenzo/build.gradle' line: 32
* What went wrong:
A problem occurred evaluating root project 'fenzo'.
> Failed to apply plugin [class 'nebula.plugin.info.dependencies.DependenciesInfoPlugin']
> Could not create plugin of type 'DependenciesInfoPlugin'.
> No signature of method: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionComparator.asStringComparator() is applicable for argument types: () values: []
Possible solutions: asVersionComparator()
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
I suspect you are using the version of gradle you have in your path:
gradle build
Try running the build with the gradle wrapper script in the repository:
./gradlew build
The version of gradle used by the wrapper is configured in gradle/wrapper/gradle-wrapper.properties. Fenzo is using 2.13 which is quite old.
By experimenting with the wrapper version, I found that it builds successfully with Gradle 2.x & 3.x but not 4.x.
Gradle 4.0 gave me the exact same error as above. 4.8 also failed but with a different error.

cascading for the impatient part 1 gradle guild fails

I've just gotten Gradle 1.4 and Hadoop 2.7.0. on my Ubuntu 14.04 VM.
I'm in the part1 directory for the Cascading for the Impatient tuturial repo.
When I run 'gradle clean jar', I get the following:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/Impatient/build.gradle' line: 29
* What went wrong:
A problem occurred evaluating root project 'impatient'.
> Could not find method jcenter() for arguments [] on repository container.
* 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: 5.502 secs
Can somebody point me in the right direction as to how to approach resolving this issue?
Also, the tutorial suggested using an IDE, and I installed Intellij, which was recommended. When I run 'gradle ideaModule', I get the same build failure message as above.
You are using Gradle 1.4 and the tutorial claims to have been tested with Gradle 1.12, so you could simply try to upgrade Gradle to 1.12 if possible.
jcenter() was added in Gradle 1.7 according to:
https://stackoverflow.com/a/27477763/4563229
Using the wrapper as described in the other answer should also work.
Try the following solution from this question - Could not find method jcenter() for arguments [] on repository container
"I ran into the same error. The following method (as described here) worked for me.
Add a task
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
and run it once. Afterwards, start using gradlew instead of gradle"

Resources