gradlew似乎在Java 10上仍然有问题(请参阅下文)。
我删除gradlew /,使用4.9做gradle包装,然后尝试gradlew -v,我得到一些警告,并且:无法从'10'确定Java版本。
有人解决吗?
编辑:gradle-wrapper属性说:
D:\ray\dev\conradapps\rabbit\gradle\wrapper>cat gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
但是我 just 用4.9创建了它,所以我很困惑:(
edit2:@Aris建议查看构建文件,果然,我在其中有一个“任务包装器(类型:包装器){gradleVersion ='2.14'}”。
edit3:从构建文件中删除包装器任务,然后通过执行gradle包装器创建另一个任务就可以了!
java版本报告:
D:\ray\dev\conradapps\rabbit>java -version
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)
D:\ray\dev\conradapps\rabbit>java --version
java 10 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)
D:\ray\dev\conradapps\rabbit>
D:\ray\dev\conradapps\rabbit>gradle -v
Welcome to Gradle 4.9!
Here are the highlights of this release:
- Experimental APIs for creating and configuring tasks lazily
- Pass arguments to JavaExec via CLI
- Auxiliary publication dependency support for multi-project builds
- Improved dependency insight report
For more details see https://docs.gradle.org/4.9/release-notes.html
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass
(file:/D:/dev/gradle-4.9/lib/groovy-all-2.4.12.jar) to method java.lang.Object.
finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groov
y.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflect
ive access operations
WARNING: All illegal access operations will be denied in a future release
------------------------------------------------------------
Gradle 4.9
------------------------------------------------------------
Build time: 2018-07-16 08:14:03 UTC
Revision: efcf8c1cf533b03c70f394f270f46a174c738efc
Kotlin DSL: 0.18.4
Kotlin: 1.2.41
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 10 ("Oracle Corporation" 10+46)
OS: Windows 8.1 6.3 amd64
D:\ray\dev\conradapps\rabbit>ls -F
165705.JPG* getalllogfiles.bat* loggger.dtd*
IMG_2708.jpg* getlogfiles.bat* pull.bat*
bin/ gradle/ run.bat*
build/ gradlew* runlogserver.bat*
build.gradle* gradlew.bat* save/
chainsaw.bat* here.sh* settings.gradle*
chainsawconfig.xml* histories.WinMerge* src/
controller.bat* jlogviewer_1_0_0d.jar* t1.bat*
deleteemptylogfiles.sh* junk.bat* testpb.bat*
deletelogfiles.bat* lib/ tmp.jar*
eyedocs.jpg* listalllogfiles.bat*
filterLogs.sh* log/
D:\ray\dev\conradapps\rabbit>rm -r gradle/
D:\ray\dev\conradapps\rabbit>gradle wrapper
Starting a Gradle Daemon (subsequent builds will be faster)
Deprecated Gradle features were used in this build, making it incompatible with
Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:comman
d_line_warnings
BUILD SUCCESSFUL in 30s
1 actionable task: 1 executed
D:\ray\dev\conradapps\rabbit>gradlew -v
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '10'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
D:\ray\dev\conradapps\rabbit>
答案 0 :(得分:0)
即使您将本地Gradle发行版升级到新版本,gradle包装器使用的版本仍然非常旧,这意味着它不支持新的Java版本。您的gradlew.properties
文件和build.gradle
包装器任务的版本可以证明这一点。
修复gradle包装器任务的gradle版本应该可以解决此问题。然后,您应该能够重新运行包装器任务并创建正确的包装器。