gpt4 book ai didi

java - ./gradlew 运行构建失败

转载 作者:太空宇宙 更新时间:2023-11-04 09:25:54 25 4
gpt4 key购买 nike

我已经设置了 build.gradle 文件,目前我的项目运行良好。现在的问题是当我运行 ./gradlew run 时,它失败并显示错误:

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

./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:

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

最佳答案

将 build.gradle 中的 mainClassName = 'src.main.java.Functional.TestRun' 替换为 mainClassName = Functional.TestRun'。您还应该修复您的 list 条目。

关于java - ./gradlew 运行构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36546422/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com