如何为 RetroLambda 设置 CircleCI 环境 JAVA7_HOME

How to setup CircleCI environment JAVA7_HOME for RetroLambda

我在我的 Android 应用程序中使用 retrolambda,并使用 circleci.com 作为我的 github 存储库的持续集成。

问题是我为Java_Home和Java7_Home配置了本地mac环境,一切正常,但我不知道如何配置circleci yml文件这个问题。

这是我的应用程序仓库:

https://github.com/mmirhoseini/weather_app

这是我在 .bash_profile 文件上的本地配置:

export JAVA_HOME=`/usr/libexec/java_home`
export JAVA7_HOME=`/usr/libexec/java_home -v 1.7`

这是我的 circleci.yml 文件:

#
# Build configuration for Circle CI
#

general:
    artifacts:
        - /home/ubuntu/weather_app/app/build/outputs/apk/

machine:
    environment:
        ANDROID_HOME: /usr/local/android-sdk-linux

    java:
      version: openjdk8

dependencies:
    override:
        - echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-23.0.3,android-23,extra-google-m2repository,extra-google-google_play_services,extra-android-support
        - ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

test:
    override:
        - (./gradlew assemble):
            timeout: 360

        - (./gradlew test):
            timeout: 360

这是 circleci 错误日志:

> Building 10%When running gradle with java 8, you must set the path to the old jdk, either with property retrolambda.oldJdk or environment variable JAVA5_HOME/JAVA6_HOME/JAVA7_HOME

请帮忙...

问题终于解决了,我通过下载旧的 java 版本并设置 Java6_home 来准备环境,然后构建 运行 我的测试。

这是我的 circleci.yml 文件:

#
# Build configuration for Circle CI
#

general:
    artifacts:
        - /home/ubuntu/weather_app/app/build/outputs/apk/
        - /usr/lib/jvm/

machine:
    environment:
        ANDROID_HOME: /usr/local/android-sdk-linux
        JAVA6_HOME: /usr/lib/jvm/java-6-openjdk-amd64

    java:
      version: openjdk8

dependencies:
    override:
        - echo y | sudo apt-get update
        - echo y | sudo apt-get install libpango-1.0-0
        - echo y | sudo apt-get install openjdk-6-jre

        - echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-23.0.3,android-23,extra-google-m2repository,extra-google-google_play_services,extra-android-support
        - ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

test:
    override:
        - (./gradlew assemble):
            timeout: 360

        - (./gradlew test):
            timeout: 360