Gradle error: "Could not find property" ... "in root project" ... "

I try to create my Java project using Gradle and I get 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 build.gradle : mainClassName = myJavaPackage.runner.MainRunner

In settings.gradle I have: rootProject.name = 'MyJavaProject'

Project directory structure:

MyJavaProjectmainjavamyJavaPackagerunnerMainRunner

I am using Gradle 11.1

Since the stack trace is huge, I did not publish it completely.

The bottom bottom shows:

Raised by: groovy.lang.MissingPropertyException: could not find the myJavaPackage property in the root MyJavaProject project.

I searched for this type of error, but the answers mostly concerned updating Gradle from the old version to the newer.

What did I do wrong?

+7
java groovy build.gradle gradle
source share
1 answer

Correctly (pay attention to quotes):

 mainClassName = "myJavaPackage.runner.MainRunner" 
+9
source share

All Articles