How to solve gradle build failed error?

0 votes

I am trying to install blockchain. I have installed gradle but when I run the following command:

gradle -b build.gradle clean

I get this exception:

org.gradle.internal.service.ServiceCreationException

and the stack trace is as follows:

Exception is: org.gradle.internal.service.ServiceCreationException: Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory(). at 
org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:797) at
org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:748) at
org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:574) at
org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:623) at
org.gradle.internal.service.DefaultServiceRegistry$FactoryService.assembleParameters(DefaultServiceRegistry.java:761) at
org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:747) at
org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:574) 

How to solve this?

Jul 12, 2018 in Blockchain by slayer
• 29,170 points
7,535 views

10 answers to this question.

0 votes

It looks like this directory doesn't have permission:

org.gradle.api.UncheckedIOException: Failed to create parent directory '/home/cvllp3/mychain/fabric/.gradle' when creating directory '/home/cvllp3/mychain/fabric/.gradle/4.2/fileHashes'

You can add permission using the chmod command

You can find the solution here: https://discuss.gradle.org/t/an-error-happens-when-gradlew-assemble-command-is-run-on-linux/4962

answered Jul 12, 2018 by digger
• 26,550 points
0 votes
Change the permission of the file:

chmod 777 <file name>

answered Dec 7, 2018 by Lamhit
How do you do that?

If you had the same error, in the error log you will see the name of the directory that does not have permission. Use chmod and change the permission of that directory. It would be if you posted your error log.

0 votes
I had a similar problem. The solution for me was to add the command in a sh file and then execute the sh file. Hope this works
answered Dec 7, 2018 by Atif
Hey. What command did you add?

I added the following command in a bash file and then executed:

gradle -b build.gradle clean

I did that. I added that command in grad.sh file and execute it using the following command:

$ ./grad.sh

But I am getting permission denied error. Please help

After creating the file, you will have to give permissions to the file. Run the following command to give permissions:

$ chmod 777 grad.sh

And then execute the file

0 votes
First disable gradle daemon and then run it
answered Dec 7, 2018 by Piyush
0 votes

Error could be due to parallel running. Try this

GRADLE_USER_HOME=.gradle ./gradlew build

answered Dec 7, 2018 by Mandis
0 votes
Try removing GRADLE_HOME and PATH and then run the command
answered Dec 7, 2018 by Aural
0 votes

Try cleaning like this:

gradlew clean dist
answered Dec 7, 2018 by Raunat
0 votes
Make sure you have your jdk updated and the jars you are using are compatible.
answered Dec 7, 2018 by Loki
0 votes
I faced the same error. I dont know what happened but a system restart solved my problem
answered Dec 7, 2018 by Gimli
First solution for every tech problem: Restart :D Worked for me too.
0 votes
I migrated the project to a different location and added jars again. The error was solved.
answered Dec 7, 2018 by Rajat
I think some settings might have been in the previous project which lead to the error.
Yes. I had made few changes, but couldn't set the configurations back to default. Had to migrate the project to get it working.

Related Questions In Blockchain

0 votes
1 answer

How to solve "Failed to deserialize creator identity error"?

It seems like the problem is caused ...READ MORE

answered Jul 13, 2018 in Blockchain by slayer
• 29,170 points
367 views
0 votes
1 answer

How to solve "Failed to get identity 'admin'" error?

It seems like this error is caused ...READ MORE

answered Jul 13, 2018 in Blockchain by slayer
• 29,170 points
36 views
0 votes
1 answer

How to fix "failed to execute script docker compose" error on windows 7?

It seems like the container is not ...READ MORE

answered Jun 27, 2018 in Blockchain by Omkar
• 67,660 points
1,584 views
0 votes
1 answer

How to solve Runtime error when querying Hyperledger?

OCI is open container initiative.. The error ...READ MORE

answered Jul 9, 2018 in Blockchain by slayer
• 29,170 points
244 views
0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
205 views
0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 26,550 points
424 views