Gradle clean fails


(Anastasia L) #1

Hi,

I’m having some problems with Gradle recently and I would be very grateful for some help here.

I have tried to do a clean in the newly created project

./gradlew clean -s

which leads to the following output:

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* 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)
        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)
        at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:623)
        at org.gradle.internal.service.DefaultServiceRegistry.doGet(DefaultServiceRegistry.java:344)
        at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:325)
        at org.gradle.initialization.DefaultGradleLauncherFactory.doNewInstance(DefaultGradleLauncherFactory.java:174)
        at org.gradle.initialization.DefaultGradleLauncherFactory.newInstance(DefaultGradleLauncherFactory.java:106)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:40)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:69)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:30)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:291)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:264)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:33)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:257)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:191)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: org.gradle.internal.service.ServiceCreationException: Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().
        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)
        at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.get(DefaultServiceRegistry.java:623)
        at org.gradle.internal.service.DefaultServiceRegistry.doGet(DefaultServiceRegistry.java:344)
        at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:325)
        at org.gradle.internal.service.scopes.BuildScopeServices.defaultScriptPluginFactory(BuildScopeServices.java:295)
        at org.gradle.internal.service.scopes.BuildScopeServices.createScriptPluginFactory(BuildScopeServices.java:287)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.internal.service.ReflectionBasedServiceMethod.invoke(ReflectionBasedServiceMethod.java:35)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:795)
        ... 51 more
Caused by: org.gradle.api.GradleException: Could not generate a proxy class for class org.gradle.plugin.management.internal.DefaultPluginResolutionStrategy.
        at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:223)
        at org.gradle.api.internal.AbstractClassGenerator.generate(AbstractClassGenerator.java:79)
        at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)
        at org.gradle.plugin.internal.PluginUsePluginServiceRegistry$BuildScopeServices.createPluginResolutionStrategy(PluginUsePluginServiceRegistry.java:113)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.internal.service.ReflectionBasedServiceMethod.invoke(ReflectionBasedServiceMethod.java:35)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:795)
        ... 65 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.gradle.api.internal.AsmBackedClassGenerator$MixInExtensibleDynamicObject
        at org.objectweb.asm.ClassWriter.getCommonSuperClass(Unknown Source)
        at org.objectweb.asm.ClassWriter.a(Unknown Source)
        at org.objectweb.asm.Frame.a(Unknown Source)
        at org.objectweb.asm.Frame.a(Unknown Source)
        at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
        at org.gradle.api.internal.AsmBackedClassGenerator$ClassBuilderImpl.addGetter(AsmBackedClassGenerator.java:459)
        at org.gradle.api.internal.AsmBackedClassGenerator$ClassBuilderImpl.addLazyGetter(AsmBackedClassGenerator.java:428)
        at org.gradle.api.internal.AsmBackedClassGenerator$ClassBuilderImpl.mixInDynamicAware(AsmBackedClassGenerator.java:258)
        at org.gradle.api.internal.AbstractClassGenerator.generateUnderLock(AbstractClassGenerator.java:120)
        ... 71 more

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

Could someone please advice how the problem could be solved?

Thank you!


(Maksim Kostromin) #2

Facing with similar issue on our GitLab CI builds, but not specially on clean, it can happen randomly for any task

$ env
MANPATH=/usr/local/share/uge8.2.1/man:/usr/share/man:/usr/local/share/man
XDG_SESSION_ID=c1792
CI_BUILD_TOKEN=xxxxxxxxxxxxxxxxxxxx
VIRTUALENVWRAPPER_SCRIPT=/usr/bin/virtualenvwrapper.sh
GUESTFISH_INIT=\e[1;34m
CI_PROJECT_VISIBILITY=public
TERM=dumb
SHELL=/bin/bash
HISTSIZE=1000
CI_REGISTRY_USER=gitlab-ci-token
SGE_CELL=default
CI_SERVER_VERSION=11.4.2
CI_BUILD_ID=49102
QTDIR=/usr/lib64/qt-3.3
OLDPWD=/local/gitlab-runner
QTINC=/usr/lib64/qt-3.3/include
CI_RUNNER_EXECUTABLE_ARCH=linux/amd64
CONFIG_FILE=/etc/gitlab-runner/config.toml
CI_COMMIT_REF_NAME=BUD-283
CI_SERVER_VERSION_PATCH=2
QT_GRAPHICSSYSTEM_CHECKED=1
DOCKER_DRIVER=overlay2
CI_SERVER_VERSION_MINOR=4
USER=nightjob
CI_PROJECT_ID=732
CI_JOB_TOKEN=xxxxxxxxxxxxxxxxxxxx
CI_RUNNER_REVISION=8af42251
CI_RUNNER_ID=59
CI_SERVER_VERSION_MAJOR=11
CI_COMMIT_DESCRIPTION=
CI_BUILD_REF_NAME=BUD-283
CI_BUILD_REF=9d991193fb3a0ade2cb2cbea6eb90f1c5caaf462
CI_PIPELINE_ID=11102
GUESTFISH_PS1=\[\e[1;32m\]><fs>\[\e[0;31m\] 
CI_COMMIT_REF_SLUG=bud-283
GITLAB_USER_NAME=Maksim Kostromin
FF_K8S_USE_ENTRYPOINT_OVER_COMMAND=true
MAIL=/var/spool/mail/nightjob
PATH=/usr/local/share/uge8.2.1/bin/lx-amd64:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/share/texttest_rhel7/texttest/bin
CI_BUILD_STAGE=test
CI_REGISTRY_PASSWORD=xxxxxxxxxxxxxxxxxxxx
CI_RUNNER_TAGS=nfs, rhel7, linux, el7
CI_PIPELINE_SOURCE=push
CI_JOB_STAGE=test
SGE_EXECD_PORT=6455
CI_SERVER_NAME=GitLab
LANG=en_US
CI_COMMIT_BEFORE_SHA=f44f4c2a34d39727e2849f944e32a0d6573047fd
GITLAB_FEATURES=
SGE_QMASTER_PORT=6454
CI_PIPELINE_IID=634
SGE_ROOT=/usr/local/share/uge8.2.1
KDEDIRS=/usr
GUESTFISH_OUTPUT=\e[0m
CI_RUNNER_VERSION=11.4.0
GITLAB_CI=true
CI_SERVER_REVISION=872549f7
CI_COMMIT_SHA=9d991193fb3a0ade2cb2cbea6eb90f1c5caaf462
HISTCONTROL=ignoredups
CI_CONFIG_PATH=.gitlab-ci.yml
CI_BUILD_NAME=test:modules
M2_HOME=/usr/share/maven
HOME=/users/nightjob
SHLVL=2
GRADLE_OPTS= -Dorg.gradle.daemon=false -Dorg.gradle.console=plain 
CI_SERVER=yes
_VIRTUALENVWRAPPER_API= mkvirtualenv rmvirtualenv lsvirtualenv showvirtualenv workon add2virtualenv cdsitepackages cdvirtualenv lssitepackages toggleglobalsitepackages cpvirtualenv setvirtualenvproject mkproject cdproject mktmpenv wipeenv allvirtualenv
CI=true
PYTHONPATH=/usr/local/share/python
LOGNAME=nightjob
QTLIB=/usr/lib64/qt-3.3/lib
CVS_RSH=ssh
CI_BUILD_REF_SLUG=bud-283
LESSOPEN=||/usr/bin/lesspipe.sh %s
CI_SHARED_ENVIRONMENT=true
SGE_CLUSTER_NAME=p6454
XDG_RUNTIME_DIR=/run/user/335
GITLAB_USER_ID=918
QT_PLUGIN_PATH=/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins
CI_JOB_ID=49102
GUESTFISH_RESTORE=\e[0m
CI_JOB_NAME=test:modules
HISTTIMEFORMAT=%F %T 
_=/usr/bin/env
$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
$ javac -version
javac 1.8.0_191
$ ./gradlew -v

------------------------------------------------------------
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(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_191 (Oracle Corporation 25.191-b12)
OS:           Linux 3.10.0-862.11.6.el7.x86_64 amd64

Why this is happening?


(Maksim Kostromin) #3

found workaround:

GRADLE_USER_HOME=.gradle ./gradlew build

In this case, each new build which is running in parallel will have unique gradle user home dir located right in repo (but not reusing same ~/.gradle folder in parallel), so files in it wont be lock each other during builds

Hope this will helps


Regards,
Maksim