开发者社区> 问答> 正文

流水线构建java版本

能提供java17的支持吗?

2023-05-12 09:54:35 PJ444799417049443328

09:54:35    [command] search plugin: Bash@1
09:54:35    find plugin Bash-1.1.0
09:54:35    done
09:54:35    [command] transfer Bash plugin
09:54:35    done
09:54:35    [command] render step task script
09:54:35    done
09:54:37    find plugin: [com.alibaba.emas.devops.plugin.BashPlugin]
09:54:37    bash plugin start
09:54:37    script: 
09:54:37    #!/bin/bash
09:54:37    if [ -f "$EMAS_RUNNER_WORK_DIR/.git_ssh" ]; then
09:54:37    export GIT_SSH="$EMAS_RUNNER_WORK_DIR/.git_ssh"
09:54:37    fi
09:54:37    function try()
09:54:37    {
09:54:37    [[ $- = *e* ]]; SAVED_OPT_E=$?
09:54:37    set +e
09:54:37    }
09:54:37    function throw()
09:54:37    {
09:54:37    exit $1
09:54:37    }
09:54:37    function catch()
09:54:37    {
09:54:37    export ex_code=$?
09:54:37    (( $SAVED_OPT_E )) && set +e
09:54:37    return $ex_code
09:54:37    }
09:54:37    function throwErrors()
09:54:37    {
09:54:37    set -e
09:54:37    }
09:54:37    function ignoreErrors()
09:54:37    {
09:54:37    set +e
09:54:37    }
09:54:37    try
09:54:37    (
09:54:37    throwErrors
09:54:37    echo "building..."
09:54:37    chmod +x ./gradlew
09:54:37    ./gradlew clean assembleRelease

09:54:37    )
09:54:37    catch || {
09:54:37    echo "[ERROR] exit $ex_code"
09:54:37    exit $ex_code
09:54:37    }
09:54:37    building...
09:54:37    Downloading https://services.gradle.org/distributions/gradle-8.1-all.zip

09:54:52    ................10%................20%................30%................40%................50%................60%................70%................80%................90%................100%


09:54:55    Welcome to Gradle 8.1!
09:54:55    Here are the highlights of this release:
09:54:55     - Stable configuration cache
09:54:55     - Experimental Kotlin DSL assignment syntax
09:54:55     - Building with Java 20
09:54:55    For more details see https://docs.gradle.org/8.1/release-notes.html
09:54:55    Starting a Gradle Daemon (subsequent builds will be faster)

09:57:19    > Task :build-logic:convention:pluginDescriptors
09:57:19    > Task :build-logic:convention:processResources

09:57:32    > Task :build-logic:convention:compileKotlin
09:57:32    > Task :build-logic:convention:compileJava NO-SOURCE
09:57:32    > Task :build-logic:convention:classes
09:57:32    > Task :build-logic:convention:jar

09:57:32    > Task :build-logic:convention:inspectClassesForKotlinIC


09:57:34    FAILURE: Build failed with an exception.
09:57:34    * Where:
09:57:34    Build file '/home/alibaba/workspace/app/build.gradle' line: 2
09:57:34    * What went wrong:
09:57:34    An exception occurred applying plugin request [id: 'b2bmarket.android.application']
09:57:34    > Failed to apply plugin 'com.android.internal.application'.
09:57:34       > Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
09:57:34          Your current JDK is located in /usr/local/openjdk-11
09:57:34          You can try some of the following options:
09:57:34           - changing the IDE settings.
09:57:34           - changing the JAVA_HOME environment variable.
09:57:34           - changing `org.gradle.java.home` in `gradle.properties`.
09:57:34    * Try:
09:57:34    > Run with --stacktrace option to get the stack trace.
09:57:34    > Run with --info or --debug option to get more log output.
09:57:34    > Run with --scan to get full insights.
09:57:34    * Get more help at https://help.gradle.org
09:57:34    BUILD FAILED in 2m 57s
09:57:34    5 actionable tasks: 5 executed

09:57:34    [ERROR] exit 1
09:57:34    execute result: false
09:57:34    [ERROR] exit 1


展开
收起
1134043585660525 2023-05-12 10:06:54 250 0
2 条回答
写回答
取消 提交回答
  • 目前很多云计算平台和 CI/CD 服务都已经支持 Java 17,建议您使用这些平台和服务构建 Java 17 应用程序,例如 Jenkins、Travis CI、GitLab CI、GitHub Actions 等等,这些服务常用语言、框架、工具的构建都提供了很好的支持。

    如果您是在自己的机器上构建 Java 17 应用,您需要安装 JDK 17,“JDK” 是指 Java Development Kit,它是 Java 编程所必需的软件开发工具包,包含了 Java 编译器、JRE 和其他开发工具。

    您可以从 Oracle 官方网站或 OpenJDK 官方网站下载 JDK 17,并按照网站提供的安装指南进行安装。安装完成后,您需要配置您的开发环境,以便在开发和构建 Java 应用的时候使用 JDK 17,具体配置方法可以参考 JDK 17 官方文档或网上的教程。

    2023-05-12 12:05:40
    赞同 展开评论 打赏
  • 值得去的地方都没有捷径

    您好,根据构建日志显示,您的应用程序需要使用Java 17才能成功构建,但是当前使用的是Java 11。您需要更新您的Java版本,或者在gradle.properties文件中指定Java 17的路径。您可以尝试以下步骤:

    确认您的系统已经安装了Java 17。 在gradle.properties文件中添加以下内容: org.gradle.java.home=/path/to/java17 将“/path/to/java17”替换为您系统中Java 17的安装路径。 重新运行构建命令。 希望这可以帮助您成功构建您的应用程序。

    2023-05-12 12:05:34
    赞同 展开评论 打赏
来源圈子
更多
收录在圈子:
基于阿里巴巴以及合作伙伴的最佳实践,围绕大前端、云原生领域的相关技术热点(小程序、Serverless、应用中间件、低代码、DevOps)展开行业探讨,与开发者一起探寻云原生时代应用研发的新范式。
问答排行榜
最热
最新

相关电子书

更多
Java开发者面试百宝书 立即下载
EXTENDING SPARK WITH JAVA AGENTS 立即下载
基于阿里云K8S服务快速构建DevOps流水线 资料下载 立即下载