Gradle wrapper not working without defining a wrapper task in 1.10


(Mike Rampson) #1

Trying to do gradle wrapper with 1.10 but I get the following error:

FAILURE: Build failed with an exception.

  • What went wrong: Task ‘wrapper’ not found in project ‘:blah’.

  • Try: Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.84 secs

It works if a define a wrapper task and set the gradleVersion to 1.10

I thought you were suppose to be able to do just gradle wrapper since 1.7 without having to define a task. The docs for latest (1.10) suggests you need to define the wrapper task as well.

Mike


(Benjamin Muschko) #2

Gradle 1.10 provides a wrapper task out of the box. Here’s an example:

$ mkdir blah
$ cd blah
$ gradle tasks
  :tasks
  ------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------
  Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]
...

Executing “gradle wrapper” creates the wrapper files.

.
├── gradle
│   └── wrapper
│  
   ├── gradle-wrapper.jar
│  
   └── gradle-wrapper.properties
├── gradlew
└── gradlew.bat

You might want to ensure that you are executing the task with the correct version.


(Mike Rampson) #3

I think the issue was that I was in a child project and tried to create a gradle wrapper in the child. It works if this is just a singleton or I’m in the parent project.