1

我有.travis.ymlJHipster 生成的文件,我想为 travis 使用采用 open jdk 12,但我无法设置它。

os:
  - linux
services:
  - docker
language: java
matrix:
  include:
    - env:
        - TRAVIS_JDK=adopt@1.12
        - NODE_VERSION=12.13.1
cache:
  directories:
    - node
    - node_modules
    - $HOME/.m2
env:
  global:
    - SPRING_OUTPUT_ANSI_ENABLED=ALWAYS
    - SPRING_JPA_SHOW_SQL=false
    - JHI_DISABLE_WEBPACK_LOGS=true
    - NG_CLI_ANALYTICS="false"
    - MAVEN_USER_HOME=$HOME/.m2/repository/
script:
  - chmod +x mvnw
  - java -version
  - ./mvnw -ntp checkstyle:check
  - ./mvnw -ntp clean verify
  - ./mvnw -ntp verify -Pprod -DskipTests
  - ./mvnw -ntp com.heroku.sdk:heroku-maven-plugin:2.0.5:deploy -DskipTests -Pprod -Dheroku.buildpacks=heroku/jvm -Dheroku.appName=kacetal-library-stock
notifications:
  webhooks:
    on_success: change  # options: [always|never|change] default: always
    on_failure: always  # options: [always|never|change] default: always
    on_start: false     # default: false

更新替代不起作用,我总是看到错误:resetting java alternatives和第二个错误update-alternatives: error: no alternatives for mozilla-javaplugin.so

而且 jdk 始终是 OpenJDK 11openjdk version "11.0.2" 2019-01-15

4

2 回答 2

1

在下面添加采用版本的矩阵,并正确添加 JAVA_HOME。

os:
  - linux
services:
  - docker
language: java

cache:
  directories:
    - node
    - node_modules
    - $HOME/.m2
env:
  global:
    - SPRING_OUTPUT_ANSI_ENABLED=ALWAYS
    - SPRING_JPA_SHOW_SQL=false
    - JHI_DISABLE_WEBPACK_LOGS=true
    - NG_CLI_ANALYTICS="false"
    - MAVEN_USER_HOME=$HOME/.m2/repository/
    - NODE_VERSION=12.13.1
  matrix:
  - TRAVIS_JDK=adopt-openj9@1.12
  - TRAVIS_JDK=adopt-openj9@1.11.0-4

script:
  - chmod +x mvnw
  - java -version
  - ./mvnw -ntp checkstyle:check
  - ./mvnw -ntp clean verify
  - ./mvnw -ntp verify -Pprod -DskipTests
  - ./mvnw -ntp com.heroku.sdk:heroku-maven-plugin:2.0.5:deploy -DskipTests -Pprod -Dheroku.buildpacks=heroku/jvm -Dheroku.appName=kacetal-library-stock
notifications:
  webhooks:
    on_success: change  # options: [always|never|change] default: always
    on_failure: always  # options: [always|never|change] default: always
    on_start: false     # default: false
于 2020-02-12T08:08:42.790 回答
0

这帮助了我:

https://docs.travis-ci.com/user/languages/java/#using-java-10-and-later

看起来您可以在.travis.yml文件中指定 1 个或多个 JDK 版本:

jdk:
  - oraclejdk8
  - oraclejdk11
  - openjdk10
  - openjdk11
于 2020-12-29T10:41:21.467 回答