gpt4 book ai didi

java - 当我使用Gradle插件编译Java代码时,本地JDK为1.8,但我想将其编译为1.7版。

转载 作者:行者123 更新时间:2023-12-03 06:29:26 26 4
gpt4 key购买 nike

当我使用Gradle插件编译Java代码时,本地JDK为1.8,但我想将其编译为1.7版。错误:javacTask:源版本1.8需要目标版本1.8

  • gradle 5.5.1
  • jdk 1.8

  • 17:56:11.435 [ERROR] [system.err] javacTask: 源发行版 1.8 需要目标发行版 1.8
    17:56:11.435 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Compile Java for :compileJava'
    17:56:11.435 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Compile Java for :compileJava' completed
    17:56:11.435 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute compile for :compileJava'
    17:56:11.435 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute compile for :compileJava' completed
    17:56:11.436 [DEBUG] [org.gradle.api.internal.changedetection.changes.TaskFingerprintUtil] Fingerprinting property destinationDir (Output) for task ':compileJava'
    17:56:11.436 [DEBUG] [org.gradle.internal.execution.impl.steps.CacheStep] Not storing result of task ':compileJava' in cache because the execution failed
    17:56:11.436 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
    17:56:11.436 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Task :compileJava'
    17:56:11.437 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Task :compileJava' completed
    17:56:11.437 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] :compileJava (Thread[Execution worker for ':',5,main]) completed. Took 1.544 secs.
    17:56:11.437 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker for ':': released lock on :
    17:56:11.437 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.2 completed (1 worker(s) in use)
    17:56:11.438 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker for ':': released lock on root.1.2
    17:56:11.438 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 2,5,main]] finished, busy: 0.0 secs, idle: 1.546 secs
    17:56:11.438 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':' Thread 3,5,main]] finished, busy: 0.0 secs, idle: 1.545 secs
    17:56:11.438 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Daemon worker Thread 4,5,main]] finished, busy: 0.0 secs, idle: 1.545 secs
    17:56:11.438 [DEBUG] [org.gradle.execution.plan.DefaultPlanExecutor] Execution worker [Thread[Execution worker for ':',5,main]] finished, busy: 1.544 secs, idle: 0.002 secs
    17:56:11.438 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskExecutionGraph] Timing: Executing the DAG took 1.548 secs
    17:56:11.439 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Run tasks'
    17:56:11.439 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Run tasks' completed
    17:56:11.440 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1 completed (0 worker(s) in use)
    17:56:11.441 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 4: released lock on root.1
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':compileJava'.
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Compilation failed; see the compiler error output for details.
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. Run with --scan to get full insights.
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
    17:56:11.441 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
    17:56:11.442 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 2s

    最佳答案

    源发布属性指定源代码以哪种语言版本(java文件)编写,目标发布属性指定针对类文件的目标运行时版本。您可能忘记了在sourceCompatibility = '1.7'块中指定compileJava

    关于java - 当我使用Gradle插件编译Java代码时,本地JDK为1.8,但我想将其编译为1.7版。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54158531/

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