Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not set unknown property 'mainClassName' for root project

Tags:

java

gradle

I am writing a spark application. With the following build.gradle file, I am getting an error as stated in the title when syncing gradle in Intellij Idea.

plugins {
  id 'java'
}

sourceCompatibility = 1.8

mainClassName = 'HelloSpark'

repositories {
  mavenCentral()
}

dependencies {
....
}
like image 436
Devs love ZenUML Avatar asked Jun 11 '19 02:06

Devs love ZenUML


1 Answers

This is because the property mainClassName is introduced by the gradle plugin application. Adding the application plugin fixed the error:

plugins {
  id 'java'
  id 'application'
}
like image 115
Devs love ZenUML Avatar answered Oct 25 '22 14:10

Devs love ZenUML