我在运行Travis CI时遇到了一些困难。我认为我的.yml文件被正确地设置为使用java8,但我得到的错误却并非如此。
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=192m; support was removed in 8.0
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.8.0_31, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-042stab105.14", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building HonestMistakesWPINav 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ HonestMistakesWPINav ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 7 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ HonestMistakesWPINav ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 24 source files to /home/travis/build/theflanman/HonestMistakesWPINav/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/travis/build/theflanman/HonestMistakesWPINav/src/main/gui/DevGUIFront.java:[214,92] lambda expressions are not supported in -source 1.5
(use -source 8 or higher to enable lambda expressions)
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.506 s
[INFO] Finished at: 2015-11-24T18:19:53+00:00
[INFO] Final Memory: 9M/134M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project HonestMistakesWPINav: Compilation failure
[ERROR] /home/travis/build/theflanman/HonestMistakesWPINav/src/main/gui/DevGUIFront.java:[214,92] lambda expressions are not supported in -source 1.5
[ERROR] (use -source 8 or higher to enable lambda expressions)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException据我所知,maven正在识别我使用的是java8,但travis正在编译1.5。我在任何地方都找不到任何关于如何改变这一点的东西,任何帮助都将不胜感激。
发布于 2015-12-01 03:21:00
你的travis.yml是什么样子的?
这是我的前三行代码,这对我来说很好(我使用gradle而不是maven)
language: java
jdk:
- oraclejdk8你必须为任何人提供更多的信息来帮助解决这个问题。
作为参考,这是我的完整travis.yml供参考。
发布于 2016-01-11 02:12:36
我解决了一个类似的问题,在我的.travis.yml文件中添加了这两行:
install: mvn install -Dmaven.compiler.target=1.8 -Dmaven.compiler.source=1.8 -DskipTests=true
script: mvn test -Dmaven.compiler.target=1.8 -Dmaven.compiler.source=1.8或者,您可以通过POM.xml指示在编译过程中使用哪个版本的JDK:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>这两种方法对我都有效。
https://stackoverflow.com/questions/33901277
复制相似问题