cascading for the impatient part 1 gradle guild fails - hadoop

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"

Related

CI cannot download gradle distribution snapshot

Our CI suddenly fails with the following error message:
$ ./gradlew clean jar --stacktrace -i --no-daemon
Downloading https://services.gradle.org/distributions-snapshots/gradle-6.8-20201019220035+0000-bin.zip
Exception in thread "main" java.io.FileNotFoundException: https://downloads.gradle-dn.com/distributions-snapshots/gradle-6.8-20201019220035+0000-bin.zip
I don't unterstand why the distribution file is not found anymore and how can we fix it? I tried clearing all caches but it fails with the same error.
There was a new gradle release on that day and upgrade the gradle wrapper solved the issue:
./gradlew wrapper --gradle-version 6.8.1
(remember to run this command twice to really update the complete wrapper)

Issue with Gradle and Gradlew

I have a project that has both gradle (6.3) and gradlew. When I do a "./gradlew build", all is fine. But when I do "gradle build" I have the following error:
What went wrong:
A problem occurred evaluating root project ....
> Failed to apply plugin [id '...']
> Could not create an instance of type ....
> org.gradle.api.file.ProjectLayout.directoryProperty()Lorg/gradle/api/file/DirectoryProperty;
Any idea what could cause the wrapper to work OK and not gradle?
Thanks - C
./gradlew build uses a different version of Gradle than what gradle build uses. That's exactly the reason for the gradle wrapper: it will look at the contents of the file gradle/wrapper/gradle-wrapper.properties to figure out which version of Gradle to use, and then automatically downloads and uses that Gradle version. The Gradle you have installed, version 6.3, is newer than the one used by the gradlew (gradle wrapper) script. This is why gradle build does not work: your build script is incompatible with this new gradle version, it only works with the older one used by the gradlew script.
The error you see is caused by an incompatibility of your Gradle build script with a newer Gradle version. Let's look at the first part:
> Could not create an instance of type ....
> org.gradle.api.file.ProjectLayout.directoryProperty()Lorg/gradle/api/file/DirectoryProperty;
It tells you that Gradle is looking for a method directoryProperty in the class ProjectLayout. This member exists up to Gradle Version 5 (see https://docs.gradle.org/5.0/javadoc/org/gradle/api/file/ProjectLayout.html) but is no longer present in Gradle 6.3 (https://docs.gradle.org/current/javadoc/org/gradle/api/file/ProjectLayout.html). So the Gradle API changed, and your build script is no longer compatible.
The second part of the error:
> Failed to apply plugin [id '...']
tells you that this happened in the implementation of the plugin (given by the ... in the id). This means that to fix the error with newer gradle versions, the plugin needs to be modified.

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.

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

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.

Resources