I'm having a problem installing gradlew... I can use the gradle command by simply typing "gradle" in the Terminal, but "gradlew" doesn't do anything. I installed gradle using
sudo apt install gradle
And it installed successfully. I have to use "sudo gradle" and not "gradle" because this shows up when I don't use sudo.
icebunny08@D3CRYPT3D:~$ gradle
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod (file:/usr/share/gradle/lib/gradle-base-services-3.4.1.jar) to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Starting a Gradle Daemon (subsequent builds will be faster)
:help
Welcome to Gradle 3.4.1.
To run a build, run gradle <task> ...
To see a list of available tasks, run gradle tasks
To see a list of command-line options, run gradle --help
To see more detail about a task, run gradle help --task <task>
BUILD SUCCESSFUL
Total time: 5.017 secs
My problems are if I installed Gradle correctly, and why can't I use the "gradlew" command. This is the output when I use "gradlew".
icebunny08@D3CRYPT3D:~$ gradlew
Command 'gradlew' not found, did you mean:
command 'gradle' from deb gradle
Try: sudo apt install <deb name>
The warnings you have when running gradle command are due to some groovy issue with JDK 9 or later, as described here.
If these warnings are a problem for you, you can use the described workaround to make them disapear:
Now about gradlew.
Gradlew is a wrapper around gradle. It is bound to a project, not to your workstation. In other words, each gradle project you develop could have a graddle wrapper coming with it. The purpose of gradlew is to make the project portable (i.e. developers don't need to install gradle on their workstation) and reliable (i.e. same version of gradle for everyone). The wrapper script will download the specified version of gradle for your project, then run it. This is all described in their documentation.
What you have done in your case is installing gradle on your workstation, globally. the gradle installation doesn't come with gradlew, as gradlew needs to be added to every gradle project of your choice, as described here. You simply have to run the following command in your project:
This will create the wrapper script for your gradle project. Obviously you need gradle to be installed to run this command (you installed it already), but if you commit the result and share it with other developers, they can use the gradlew script without installing gradle.
In your case, you end up with two possibilities:
gradle clean
. You can do this because you manually installed gradle globallygradlew clean
. You can do this because you created the wrapper script withgradle wrapper
in the first place.Both should give the same result if the gradle version is the same.