Gradle wrapper - genious idea, could be even better


(Tomasz Bartczak) #1

Idea after gradle wrapper is great. But usage of wrapper could be better.

When I heard about wrapper I imagined it would work like that: When I run gradle - the process that is run is effectively a wrapper. it would look for a version {1.0-Final} or something similiar in build.gradle, download specified gradle version if not yet available and run current build using this version of gradle.

If there is no version information in build.file - wrapper could use newest available.

So downloading current version of gradle would mean I download a wrapper with this one version managed.

And that’s it - I think wrapper built in this way would be much easier to use.


(Peter Niederwieser) #2

That’s exactly what the wrapper doing, except that it reads the Gradle version from gradle’gradle-wrapper.properties.


(Tomasz Bartczak) #3

Almost. To the point that I have to a) add a taks to build.gradle b) execute ‘gradle wrapper’ c) have some additional files in my project folder, while I really love to minimize gradle files. d) use a second command gradlew instead of just one command gradle all that makes using wrapper not-that-intuitive.

I am for - make gradle a wrapper itself, which would simplify it for a user.


(Andrew Oberstar) #4

You only need to run the task once. Then you can remove it.

If you don’t include the wrapper files with your project, you make the assumption that everyone has the wrapperized version of Gradle installed. That may or may not be a legitimate assumption, depending on what your developing.

I have seen some of the devs talk about making the gradle command wrapper-aware. That might get close to what you are looking for.


(Dinkar Ganti) #5

Is there a condition when the gradle wrapper task can fail with Null charset name exception?


(Dinkar Ganti) #6

My post may be too old for this discussion, is there any other topic where wrapper is being discussed that I need to post the issue to? Thanks for this post and I thought that wrapperizing gradle should be a simple task.Though, for some reason on the Mac osx I am facing the following issue:

I am facing the following exception when running gradle wrapper task:

//A wrapper to generate gradle wrapper files task wrapper(type: Wrapper) {

gradleVersion = ‘1.0’ }

:wrapper

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:wrapper’. > Null charset name

  • Try:

Any pointers will help. Thanks.


(René Groeschke) #7

Can you run the task again with “–stacktrace” and paste the stacktrace here, embedded in a code tag?

thanks, René


(Dinkar Ganti) #8
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':wrapper'.
 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68)
 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
 at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
 at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)
 at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:200)
 at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:172)
 at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:198)
 at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:137)
 at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
 at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)
 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:247)
 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:61)
 at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
 at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
 at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
 at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)
 at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
 at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)
 at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:129)
 at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
 at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
 at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
 at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
 at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
 at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
 at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
 at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)
 at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
 at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
 at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
 at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
 at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:30)
 at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:22)
 at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:200)
 at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:173)
 at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
 at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:138)
 at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
 at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
 at org.gradle.launcher.Main.doAction(Main.java:48)
 at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
 at org.gradle.launcher.Main.main(Main.java:39)
 at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
 at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
 at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: java.lang.IllegalArgumentException: Null charset name
 at org.gradle.api.internal.plugins.StartScriptGenerator.generateNativeOutput(StartScriptGenerator.groovy:110)
 at org.gradle.api.internal.plugins.StartScriptGenerator.this$2$generateNativeOutput(StartScriptGenerator.groovy)
 at org.gradle.api.internal.plugins.StartScriptGenerator$this$2$generateNativeOutput.callCurrent(Unknown Source)
 at org.gradle.api.internal.plugins.StartScriptGenerator.generateUnixScriptContent(StartScriptGenerator.groovy:72)
 at org.gradle.api.internal.plugins.StartScriptGenerator.generateUnixScript(StartScriptGenerator.groovy:59)
 at org.gradle.api.tasks.wrapper.Wrapper.generate(Wrapper.java:111)
 at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:196)
 at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:102)
 at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:99)
 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$4.execute(AnnotationProcessingTaskFactory.java:150)
 at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:145)
 at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:472)
 at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:461)
 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60)
 ... 57 more

Here is the stack trace. Thanks.


(Peter Niederwieser) #9

Answering your question, it would have been better to create a new topic.


(Peter Niederwieser) #10

This exception means that your JVM doesn’t have the standard system property ‘file.encoding’ set, which is weird and will cause problems with many Java libraries (not just Gradle). Do you have an explanation for this? Also, can you show the output of ‘gradle -v’?


(Dinkar Ganti) #11

I have been using gradle for a while including compiling building and testing our installation with no issues until I added the wrapper task.

Here is the output for gradle -v.

------------------------------------------------------------
Gradle 1.1
------------------------------------------------------------
  Gradle build time: Tuesday, July 31, 2012 1:24:32 PM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.6.0_33 (Apple Inc. 20.8-b03-424)
OS: Mac OS X 10.7.4 x86_64