Gradle build error when building with service account

Hi,

During gradle build, getting below error

Failed to apply plugin [class 'org.gradle.api.plugins.JavaBasePluginRules']
   > Could not create plugin of type 'JavaBasePluginRules'.
      > Could not create service of type AnnotationProcessorDetector using JavaGradleScopeServices.createAnnotationProcessorDetector().

When tried with root user, build was success, when we tried same command with server account, getting above error.

Can you share a build --scan?
Do you maybe have files in your project that are restricted to root and thus causes the non-root user to be unable to work with them?

Hi @Vampire , ran gradle build --scan with non-root user, still getting the same issue

* What went wrong:
A problem occurred evaluating root project 
> Failed to apply plugin [class 'org.gradle.api.plugins.JavaBasePluginRules']
   > Could not create plugin of type 'JavaBasePluginRules'.
      > Could not create service of type AnnotationProcessorDetector using JavaGradleScopeServices.createAnnotationProcessorDetector().

gradle version 4.10.2, centos

Of course you get the same error, I asked whether you can share the build --scan.
Or does it not come far enough to create one?
What do you get with --stacktrace?
What with --version?

when ran sudo gradle build with non root user, build is success

Gradle 4.10.2

Build time: 2018-09-19 18:10:15 UTC
Revision: b4d8d5d170bb4ba516e88d7fe5647e2323d791dd

Kotlin DSL: 1.0-rc-6
Kotlin: 1.2.61
Groovy: 2.4.15
Ant: Apache Ant™ version 1.9.11 compiled on March 23 2018
JVM: 1.8.0_232 (Oracle Corporation 25.232-b09)
OS: Linux 3.10.0-1062.1.1.el7.x86_64 amd64

with --stacctrace

Caused by: java.io.FileNotFoundException: /home/gitlab-runner/builds//.gradle/4.10.2/fileContent/fileContent.lock (Permission denied)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:206)
at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:211)
at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)

removed .gradle folder, build is success now

1 Like

Yeah, what I said.
You run with root privileges but as that user and thus created files that were owned by root which you were not able to handle.