Gradle exception while building GraniteDS project - java

Good day, everyone.
I'm trying to build GraniteDS project locally: https://github.com/graniteds/graniteds
but when I try to build it I'm facing:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'graniteds-master'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:76)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$1.run(DefaultScriptPluginFactory.java:148)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:156)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.NoClassDefFoundError: org.gradle.internal.nativeplatform.filesystem.FileSystems
at org.gradlefx.conventions.GradleFxConvention.class$(GradleFxConvention.groovy)
at org.gradlefx.conventions.GradleFxConvention.$get$$class$org$gradle$internal$nativeplatform$filesystem$FileSystems(GradleFxConvention.groovy)
I can find this class: org.gradle.internal.nativeplatform.filesystem.FileSystems
in GRADLE_HOME/lib/gradle-native-2.4.jar
Does anyone know why that can happen?

I'm guessing you have installed gradle on your machine and are building using the gradle command. The preferred way of using gradle is not to install it on your machine explicitly, and instead include the gradle wrapper in your source which lazily downloads a specific gradle version.
I note that the project has included a gradle wrapper (gradlew.bat) and I'm guessing that the version is different from that installed in GRADLE_HOME on your machine.
Try using the supplied gradle wrapper instead which just means typing gradlew instead of gradle.

Related

How to Revert Nested Project in Eclipse [duplicate]

When I create a Gradle project in Eclipse the result is a nested project with a -lib folder created automatically. Any ideas on why this is being created?
I tested this on Eclipse 2021-03 using the latest gradle version 7.0-rc-1 and reproduced your issue where a nested project with a lib subproject was created. I then made a new Eclipse project specifying Gradle version 6.6 to be used and the resulting project was not nested. I suggest trying Gradle 6.6 and seeing if you get the same behavior I got. This might fix your project.
Also try running the gradle init command from the command line and see what project structure you get there. I tested this on my PC where I have gradle 5.6 as the default version and got a non nested structure. You can of course always manually modify your gradle project in a few minutes to not be nested.

Spotbugs build issue

Built failed while creating aws-sdk-v2 jars due to spotbugs plugin.
Steps to reproduce the error:
clone latest version of aws-sdk-java-v2
In terminal, go to directory and run mvn clean install
Error:
Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:3.1.11:spotbugs (spotbugs) on project aws-sdk-java-pom: Execution spotbugs of goal com.github.spotbugs:spotbugs-maven-plugin:3.1.11:spotbugs failed: Unable to load the mojo 'spotbugs' in the plugin 'com.github.spotbugs:spotbugs-maven-plugin:3.1.11'. A required class is missing: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
I tried to rebuild the project by deleting spotbugs-maven-plugin but I that didn't solve the problem.
I had no .mavenrc file yet, but recently had added Java 17 to test something via Home Brew. As a result, I started seeing this issue. I created a ~/.mavenrc and added the following to it:
JAVA_HOME=`/usr/libexec/java_home -v 1.8.0`
This allowed me to get back to using Java 8 with Maven just like my default Java version would be.
I had a similar problem and it turned out my installation of Java 15 was the culprit. Once I got maven to use my standard java version (1.8 Corretto) I could build the project again. Use mvn -version to check which java it's currently using.
Personally I had to set JAVA_HOME in my .mavenrc file, setting it in my bash profile didn't help.

Gradle project doesn't build on my machine, but does on everyone else's

I'm trying to start some work on a Gradle project, but I get a strange error when attempting to build the project on my machine. Currently, we have a Gradle project that builds successfully for all other members of my team, all they need to do is clone the project and it builds without any problems. For myself, that isn't the case.
If I execute the gradle wrapper manually from the terminal:
./gradlew build
the project builds without any errors, but the Gradle synchronisation fails when importing the project into an IDE, giving the following error:
* What went wrong:
Could not resolve all dependencies for configuration ':billing-
provisioning-consumer-finance-details:compile'
I assume that it can't be a problem with the project structure, nor anything wrong with the build.gradle, since it builds without error on other machines.
So far I've tried:
Re-cloning the project (several times)
Clearing the gradle cache at ~/.gradle/caches
Clearing ~/.m2/repositories
Building the project in another IDE (Eclipse), which still gives the same error.
You can follow these steps :
Download Gradle from Gradle
Create or Export GRADLE_HOME as environment variable.Ex: E:\SoftwareRepo\building tools\gradle-4.4.1
Add to Path or Export Path Variable PATH=[YOUR GRADLE_HOME/bin] . ex. E:\SoftwareRepo\building tools\gradle-4.4.1\bin
Open cmd or terminal anywhere in your PC and run gradle --v . If gradle install successfully it will show installed gradle info.
Clone your gradle project
Go to project root directory. Open terminal and run gradle clean build
If there is still error then it will be probably your project is not correctly configured.
If you tried with intelij idea then you need to try this
File->Open. then select your source folder.
then a popup will come select local destribution gradle

Error for gradle build for my Java project

I am trying to build the Java project located at here: https://github.com/garlicPasta/dotServer
I'm new to Gradle. I downloaded the latest Gradle now (v4.0). I added the bin folder of Gradle (which includes gradle.bat) to the path so I can run gradle command everywhere. Looks like the project requires Google protobuf which it downloads automatically. But when I start the command gradle build, I get the following error:
> Configure project :
You are using Gradle 4.0: This version of the protobuf plugin works with Gradle version 2.12+
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'dotServer'.
> No signature of method: org.gradle.api.internal.tasks.DefaultTaskInputs.source() is applicable for argument types: (com.google.protobuf.gradle.ProtobufSourceDirectorySet_Decorated) values: [main Proto source]
Possible solutions: collect(), use([Ljava.lang.Object;)
Where is the problem coming from? Can someone try to build the project and let me know?
I just upgraded to Android Studio 3 and had the same problem when I upgrade Gradle and it's plugin.
We use Google's Protobuf which was included in build.gradle with version 0.7.6. I just changed to 0.8.3 and it builds now.
buildscript {
...
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
}
}

How do I change the Gradle version the Eclipse SpringSource plugin uses?

Note this is for the SpringSource plugin.
When I try to import a Gradle project in Eclipse I am getting the following error:
Project location doesn't exist; See error log for details.
The stacktrace error is basically this:
Caused by: java.lang.IllegalArgumentException: Project location doesn't exist
I did some research, and a Gradle defect (https://issuetracker.springsource.com/browse/STS-3158) mentions that error handling was improved with a more useful error message, including the project location.
I have Gradle 1.7 now on my machine; however Eclipse/Springsource keeps using Gradle 1.2. How do I get it to use 1.7 (or even 1.8)
I recommend to check "Preferences->Gradle->Use Gradle wrapper's default" and install the Gradle Wrapper for all builds in question. Then Eclipse will automatically pick the right Gradle version for each build (and nobody has to install Gradle manually).

Categories

Resources