I try do build my Java project with Gradle
and I'm getting the following:
Starting Build
Settings evaluated using settings file 'C:\Users\MyName\Java8\MyJavaProject\settings.gradle'.
Projects loaded. Root project using build file 'C:\Users\MyName\Java8\MyJavaProject\build.gradle'.
Included projects: [root project 'MyJavaProject']
Evaluating root project 'MyJavaProject' using build file 'C:\Users\MyName\Java8\MyJavaProject\build.gradle'.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\MyName\Java8\MyJavaProject\build.gradle' line: 25
* What went wrong:
A problem occurred evaluating root project 'MyJavaProject'.
> Could not find property 'myJavaPackage' on root project 'MyJavaProject'.
Line 25 of build.gradle
: mainClassName = myJavaPackage.runner.MainRunner
In settings.gradle
I have: rootProject.name = 'MyJavaProject'
Project directory structure:
MyJavaProject
-> main
-> java
-> myJavaPackage
-> runner
-> MainRunner
I'm using Gradle 11.1
Since the stack trace is huge I did not post the entire one.
Close to the bottom it shows:
Caused by: groovy.lang.MissingPropertyException: Could not find property 'myJavaPackage' on root project 'MyJavaProject'.
I searched for this type of error but the answers were mostly about upgrading Gradle from an old version to a newer one.
What did I do wrong?
Using the -D command-line option, you can pass a system property to the JVM which runs Gradle. The -D option of the gradle command has the same effect as the -D option of the java command. You can also set system properties in gradle. properties files with the prefix systemProp.
gradle files are located. The build. gradle (Project: MyApplication) file is in the root folder of the project and its configuration settings apply to every module in the project.
A problem occurred configuring root project 'gradleOut'. > Could not resolve al 1 1.Change the position of jcenter and google in project gradle file and in also all the other module you have in your... 2 Before building your project again go to your project folder and delete the .gradle folder from your project and then... More ...
If not, here are some things you might see instead. If you get "command not found: gradle", you need to ensure that Gradle is properly added to your PATH. If you get something like: ERROR: JAVA_HOME is set to an invalid directory Please set the JAVA_HOME variable in your environment to match the location of your Java installation.
You need to apply the gradle-processors plugin to your subprojects, not the top-level project. I would recommend configuring your subprojects in a separate file, e.g. A/build.gradle, B/build.gradle, rather than having one huge top-level file like this. You can pull those files in in your settings.gradle: Sorry, something went wrong.
If you get "permission denied", that means that Gradle likely exists in the correct place, but it is not executable. You can fix this using chmod +x path/to/executable on *nix-based systems.
Correct is (notice the quotes):
mainClassName = "myJavaPackage.runner.MainRunner"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With