如何修复错误:无法从“11.0.2”确定 java 版本。在特拉维斯?
Posted
技术标签:
【中文标题】如何修复错误:无法从“11.0.2”确定 java 版本。在特拉维斯?【英文标题】:How do I fix the error : Could not determine java version from '11.0.2'. in travis? 【发布时间】:2019-08-06 05:28:51 【问题描述】:我使用 travis.yml 在 travis 中运行 gradle:
language:java
jdk:
oraclejdk11
dist:trusty
addons:
sonarcloud:
organization;steinko-github
token:
secure: xxxxxxx
script:
- gradle:build
- sonar-scanner
And the gradle.build
buildscript
repositories
jcenter()
dependencies
classpath 'com.bmuschko:gradle-clover-plugin:2.2.2'
plugins
id: 'java'
apply plugin: 'com.bmuschko.clover'
group: 'org.steinko.springtutorial'
version: '1.0-SNAPSHOT'
sourceCompatibility: 1.11
allprojects:
repositories
jcenter()
subprojects
version: '1.0'
repositories
mavenCentral()
test
JUnitPlatform()
dependencies
clover:org.openclover:clover:4.3.1'
testCompile group:'org.mockito'; name: 'mockito-core': version:'2.25.0'
compile group:org.slf4j':name: 'slf4j-api': version:'1.7.+'
compile;group:'ch.qos.logback';name;'logback-classic':version: '1.+'
testImplementation;'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly;'org.junit.jupiter:junit-jupiter-engine:5.3.1'
我收到一个错误:
git.checkout
0.57s
$ git clone --depth=50 --branch=master https://github.com/steinko/guess-the-number-game.git
steinko/guess-the-number-game
Cloning into 'steinko/guess-the-number-game'...
remote: Enumerating objects: 144, done.
remote: Counting objects: 100% (144/144), done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 144 (delta 48), reused 128 (delta 32), pack-reused 0
Receiving objects: 100% (144/144), 115.07 KiB | 2.26 MiB/s, done.
Resolving deltas: 100% (48/48), done.
$ cd steinko/guess-the-number-game
$ git checkout -qf 56104bc52ebae538e665fc4d5b42a02d32c4d1d0
$ export TERM=dumb
$ java -Xmx32m -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
$ javac -J-Xmx32m -version
javac 11.0.2
install
21.03s$ ./gradlew assemble
Downloading
https://services.gradle.org/distributions/gradle-5.2.1-all.zip
..............................................................................................................................
Welcome to Gradle 5.2.1!
Here are the highlights of this release:
- Define sets of dependencies that work together with Java Platform plugin
- New C++ plugins with dependency management built-in
- New C++ project types for gradle init
- Service injection into plugins and project extensions
For more details see https://docs.gradle.org/5.2.1/release-notes.html
To honour the JVM settings for this build a new JVM will be forked.
Please consider using the daemon:
https://docs.gradle.org/5.2.1/userguide/gradle_daemon.html.
Daemon will be stopped at the end of the build stopping after
processing
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :jar
> Task :assemble
> Task :core:compileJava
> Task :core:processResources
> Task :core:classes
> Task :core:jar
> Task :core:assemble
BUILD SUCCESSFUL in 20s
5 actionable tasks: 5 executed
sonarcloud.addon
SonarCloud addon
addon hash: de356982c12b370c7bfe9c5317053863
Preparing SonarQube Scanner CLI
Archive: /home/travis/.sonarscanner/sonar-scanner.zip
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner-debug.bat
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-runner.bat
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner.bat
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-runner
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner-debug
creating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/conf/
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/conf/sonar-scanner.properties
creating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/lib/
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/lib/sonar-scanner-cli-3.0.3.778.jar
$ export SONAR_SCANNER_HOME=$TRAVIS_HOME/.sonarscanner/sonar-scanner-3.0.3.778
Not installing SonarSource build-wrapper because it's a Java or javascript project
Preparing SonarQube Scanner parameters
0.88s$ gradle build
FAILURE: Build failed with an exception.
* What went wrong: Could not determine java version from '11.0.2'.
* Try: Run with --stacktrace option to get the stack trace. Run with --info
or --debug option to get more log output.
The command "gradle build" exited with 1.
如何修复错误?
【问题讨论】:
【参考方案1】:这很可能是你的问题:
$ gradle build
您的 gradle 包装器是 5.2.1 版(您使用 ./gradlew 安装的),但您的系统范围的 gradle 可能不是。尝试执行 ./gradlew build
代替(或使用 gradle build
但将系统范围的 gradle 更新为 5.0 之后的版本)
【讨论】:
以上是关于如何修复错误:无法从“11.0.2”确定 java 版本。在特拉维斯?的主要内容,如果未能解决你的问题,请参考以下文章
如何修复 npm start “无法确定原生 SDK 版本”错误?
嗨,我不知道如何修复此游标错误,“java.lang.IllegalStateException:无法从 CursorWindow 读取第 0 行,第 1 列。”