Task 'wrapper' not found in project

I would like to upgrade Gradle Wrapper version from 7.0.2 to 8.2.1 using command from official documentation(The Gradle Wrapper)):

./gradlew wrapper --gradle-version 8.2.1 --distribution-type bin

Installed local Gradle:

$ gradle -v

------------------------------------------------------------
Gradle 8.2.1
------------------------------------------------------------

Build time:   2023-07-10 12:12:35 UTC
Revision:     a38ec64d3c4612da9083cc506a1ccb212afeecaa

Kotlin:       1.8.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.7 (Oracle Corporation 17.0.7+8-LTS-224)
OS:           Windows 11 10.0 amd64

According to the official documentation (Gradle 7.0.2):

Every vanilla Gradle build comes with a built-in task called wrapper

But when I try to run the commands:

// using local Gradle
$ gradle wrapper --gradle-version 8.2.1 --distribution-type bin

// or using wrapper
$ ./gradlew wrapper --gradle-version 8.2.1 --distribution-type bin

I get an error:

FAILURE: Build failed with an exception.

* What went wrong:
Task 'wrapper' not found in project ':prj-name-here'.

Why does the official documentation say that Gradle has a ā€œwrapperā€ task, but when I try to run this task, I get an error that this task does not exist?

What did Gradle developers smoke?

Why are you such a dork?

Honestly, Iā€™m not one of those people you just insulted, but such a behavior is pretty much not ok in any community.

And even if the documentation were wrong, or the implementation wouldnā€™t work that way anymore, it would simply be a documentation bug or implementation bug as you have them in any software on the planet.

In this case though it is just you not understanding / using it properly.
ā€œTask ā€˜wrapperā€™ not found in project ā€˜:prj-name-hereā€™.ā€ means that you are inside the subproject prj-name-here when you run that command, but the wrapper task is only available on the root project.
So either go to the root project directory and execute the same line there, or use the absolute task path :wrapper to call the wrapper task on the root project even if you are inside a sub project directory.

And next time before you post, please first go outside your house, walk around the block, let off steam, and then think about what you write before you send it, thanks.

1 Like

In this case though it is just you not understanding / using it properly.

Before using, I read the documentation. If you think that people should have the ability of psychics and guess how and what should work, then I feel sorry for you. For this, documentation exists, so that people read and do as it is written in the documentation, and not invent, invent, guess, turn to voodoo shamans to get answers

but the wrapper task is only available on the root project.

This is not stated in the documentation.

So either go to the root project directory and execute the same line there, or use the absolute task path :wrapper to call the wrapper task on the root project even if you are inside a sub project directory.

You first write that you need to go to the root directory of the project and execute the task there, because it does not work inside the subproject. Then you write that you need to use an absolute path. Does that mean the team is still working or not? You decide already, please.

If you think that people should have the ability of psychics and guess how and what should work, then I feel sorry for you.

I do not, but again, please watch your tone.
You are in a user community here and ask other users like me to help you in their spare time.
It is all documented, how you call tasks in the documentation at Multi-Project Builds, both executing by simple name, also regarding executing from a subproject and also about executing by fully qualified name.

For this, documentation exists, so that people read and do as it is written in the documentation, and not invent, invent, guess, turn to voodoo shamans to get answers

Yes, and it is all documented, no shamans necessary.

but the wrapper task is only available on the root project.

This is not stated in the documentation.

Thatā€™s not fully true.
Each usage that is shown using ./gradlew assumes you are running this from the root project as that is the place where the gradlew script is checked in if done like documented.
Also the output of the shown wrapper task execution shows that it is a task on the root project.
And the documentation also tells you too look at the task-listing to find the wrapper task.

But if you think the documentation is not clear enough at some place, you are always welcome to open a feature request or pull request at Issues Ā· gradle/gradle Ā· GitHub to get an improvement.

You first write that you need to go to the root directory of the project and execute the task there, because it does not work inside the subproject. Then you write that you need to use an absolute path. Does that mean the team is still working or not? You decide already, please.

I did not say that.
I said, you can either go to the root directory and use the line you used, or you can use the absolute path from where you tried, so ./gradlew :wrapper.