[GRADLE-1941] Strange exception in while executing wrapper task Created: 18/Nov/11  Updated: 04/Jan/13  Resolved: 15/Jan/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-6
Fix Version/s: 1.0-milestone-8

Type: Bug
Reporter: Joern Huxhorn Assignee: Adam Murdoch
Resolution: Fixed Votes: 0


 Description   

I defined the gradle wrapper like this:


task wrapper(type: Wrapper) {
    gradleVersion = '1.0-milestone-6'
}

and executed gradle wrapper with my installed milestone-5. Works.
I then executed ./gradlew wrapper, i.e. using milestone-6.

./gradlew wrapper --stacktrace
:wrapper

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':wrapper'.
Cause: org/gradle/wrapper/GradleWrapperMain

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

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':wrapper'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:71)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:48)
	at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
	at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:243)
	at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
	at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
	at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
	at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)
	at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)
	at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)
	at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
	at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
	at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
	at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
	at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:233)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:217)
	at org.gradle.launcher.Main.doAction(Main.java:48)
	at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
	at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
	at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
	at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
	at org.gradle.launcher.Main.main(Main.java:39)
	at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
	at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
	at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
	at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:124)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:53)
Caused by: java.lang.NoClassDefFoundError: org/gradle/wrapper/GradleWrapperMain
	at org.gradle.api.tasks.wrapper.Wrapper.generate(Wrapper.java:117)
	at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158)
	at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)
	at org.gradle.api.tasks.wrapper.Wrapper_Decorated.invokeMethod(Unknown Source)
	at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
	at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:129)
	at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:127)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)
	... 40 more
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
	... 48 more


BUILD FAILED

Calling ./gradlew wrapper again will just work afterwards.

Not sure how serious this is...



 Comments   
Comment by Szczepan Faber [ 20/Nov/11 ]

>I then executed ./gradlew wrapper, i.e. using milestone-6.

I suspect you have changed the version of gradle in gradle-wrapper.properties?

If that's the case I think it is not really serious. Looks like something has changed on our side in the implementation of the gradle-wrapper.jar (a thin jar that deals mostly with downloading gradle version). So if update version in the properties file, you don't get newer version of the wrapper jar (AFAIR). Usually it's ok to change the version in the properties file, because wrapper jar changes very rarely. However, the safest method is to update the task and then re-run the task.

In future we will rework the wrapper anyway so that it acts by default and no explicit task is needed (we have a jira ticket for it somewhere).

For now, I'm closing this ticket. Thanks for reporting!

Comment by Szczepan Faber [ 20/Nov/11 ]

Issue should go away when we fix GRADLE-1372

Comment by Adam Murdoch [ 20/Nov/11 ]

This is a real issue, unrelated to GRADLE-1372.

Comment by Joern Huxhorn [ 20/Nov/11 ]

It is also reproducible. If I reexecute gradle wrapper using milestone-5 and execute ./gradlew wrapper afterwards, the same exception is thrown once again.

I didn't manually change the version in gradle.properties. Previously, the wrapper was set to milestone-5 and then I switched it over to milestone-6.

Hope that helps.

Generated at Wed Jun 30 12:08:29 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.