简体   繁体   English

./gradlew运行失败

[英]./gradlew run BUILD FAILED

I have my build.gradle file set up and my project is working good so far. 我已经建立了build.gradle文件,到目前为止我的项目运行良好。 The problem now is when i run ./gradlew run, it fails with the error : 现在的问题是当我运行./gradlew运行时,它失败并显示以下错误:

What went wrong: Execution failed for task ':run'. 出了什么问题:任务':run'的执行失败。 Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 1 进程'命令'/ usr / lib / jvm / java-7-openjdk-amd64 / bin / java''完成,退出值非零1

./gradlew build BUILD SUCCESSFULLY, Any clue as to why, Have also tried to check previous thread but all to no avail.Below is my gradle.build file: ./gradlew build建立成功,关于原因的任何线索,也曾尝试检查以前的线程,但无济于事。以下是我的gradle.build文件:

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'

mainClassName = 'src.main.java.Functional.TestRun'

repositories {
mavenCentral()
}
sourceSets {
selenium
}

jar {
baseName = 'gs-gradle'
version =  '0.1.0'
manifest {
    attributes 'Main-Class': 'main.java.Functional.TestRun'
   }
}
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}

dependencies {
seleniumCompile 'junit:junit:4.11'
seleniumCompile 'org.seleniumhq.selenium:selenium-java:2.45.0'
seleniumCompile 'org.seleniumhq.selenium:selenium-server:2.45.0'    
compile fileTree(dir: 'libraries', include: '*.jar') 
}
task jettyDaemon(type: org.gradle.api.plugins.jetty.JettyRun) {
daemon = true
}
task selenium(type: Test, dependsOn: jettyDaemon) {
testClassesDir = sourceSets.selenium.output.classesDir
classpath = sourceSets.selenium.runtimeClasspath
}
eclipse {
classpath {
    plusConfigurations += configurations.seleniumCompile
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}

ERROR: 错误:

ola@ola-VirtualBox:~/workspace/mainsite_automation$ ./gradlew run
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
Error: Could not find or load main class src.main.java.Functional.TestRun
:run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished           
with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --     
debug option to get more log output.

BUILD FAILED

Total time: 2.185 secs

Replace mainClassName = 'src.main.java.Functional.TestRun' in your build.gradle by mainClassName = Functional.TestRun' . mainClassName = 'src.main.java.Functional.TestRun'替换为mainClassName = Functional.TestRun' You should also fix your manifest entry. 您还应该修复清单条目。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM