不知道我的build.gradle文件出了什么问题。我是gradle的新手,所以我不理解错误。它允许我运行gradle build,gradle init,gradle任务等,但是当我运行“gradle run”时构建失败
screenshot of my command line
这是我的build.gradle:
plugins {
id 'com.github.spotbugs' version '1.6.5'
}
apply plugin: 'application'
///////////////////////////////////////////////////////////////////////////
// Definint Main class
///////////////////////////////////////////////////////////////////////////
mainClassName = 'main.java.main'
repositories {
mavenCentral()
}
dependencies {
compile "junit:junit:4.12"
}
///////////////////////////////////////////////////////////////////////////
// Configure Checkstyle
///////////////////////////////////////////////////////////////////////////
apply plugin: 'checkstyle'
checkstyle {
// Keep checkstyle a little quieter
ignoreFailures = true
showViolations = false
}
tasks.withType(Checkstyle) {
reports {
html.enabled = true
xml.enabled = false
}
}
checkstyle {
toolVersion = "8.8"
}
///////////////////////////////////////////////////////////////////////////
// Configure SpotBugs
///////////////////////////////////////////////////////////////////////////
// The part below needs to be included for Spotbugs
spotbugs {
toolVersion = '3.1.1'
}
// // To generate an HTML report instead of XML
tasks.withType(com.github.spotbugs.SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
}
最佳答案
您已将主要类(class)设置为mainClassName = 'main.java.main'
检查这是否正确。该值应该是主类的完全限定名称,即包含main()
方法的类。
关于java - 任务 ':run'的执行失败。 >流程'命令...以非零退出值1完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53491931/