简体   繁体   English

无法为根项目设置未知属性“mainClassName”

[英]Could not set unknown property 'mainClassName' for root project

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. 使用以下build.gradle文件,我在Intellij Idea中同步gradle时收到标题中所述的错误。

plugins {
  id 'java'
}

sourceCompatibility = 1.8

mainClassName = 'HelloSpark'

repositories {
  mavenCentral()
}

dependencies {
....
}

This is because the property mainClassName is introduced by the gradle plugin application . 这是因为gradle插件application引入了属性mainClassName Adding the application plugin fixed the error: 添加application插件修复了错误:

plugins {
  id 'java'
  id 'application'
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法为 org.springframework.boot.gradle.dsl.SpringBootExtension 类型的扩展“springBoot”设置未知属性“mainClassName” - Could not set unknown property 'mainClassName' for extension 'springBoot' of type org.springframework.boot.gradle.dsl.SpringBootExtension 无法为 org.gradle.api.Project 类型的根项目“[redacted]”获取未知属性“artifactory_contextUrl” - Could not get unknown property 'artifactory_contextUrl' for root project '[redacted]' of type org.gradle.api.Project 无法为org.gradle.api.Project类型的根项目“MyApplication3”获取未知属性“删除” - Could not get unknown property 'Delete' for root project 'MyApplication3' of type org.gradle.api.Project Gradle错误:“无法在根项目中找到属性'...'''' - Gradle error: "Could not find property '…' on root project '…' 在根项目gradle上找不到属性“ sourceSets” - could not find property 'sourceSets' on root project gradle 在根项目“ admob”上找不到属性“ eclipse” - Could not find property 'eclipse' on root project 'admob' Gradle:无法在 Intellij 中设置未知属性“classDumpFile” - Gradle: could not set unknown property 'classDumpFile' in Intellij 无法为扩展“应用程序”设置未知属性“mainClass” - Could not set unknown property 'mainClass' for extension 'application 无法在 Gradle 中设置未知属性“applicationDefaultJvmArgs” - Could not set unknown property 'applicationDefaultJvmArgs' in Gradle groovy.lang.MissingPropertyException:无法为类型为org.gradle.api.Project的项目':flamingo'设置未知属性'versionKey' - groovy.lang.MissingPropertyException: Could not set unknown property 'versionKey' for project ':flamingo' of type org.gradle.api.Project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM