如何为RetroLambda设置CircleCI环境JAVA7_HOME

时间:2016-05-26 08:29:23

标签: android java-home circleci retrolambda

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

问题是我已经为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

请帮忙......

1 个答案:

答案 0 :(得分:1)

最后问题解决了,我通过下载较旧的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