让Travis CI运行起来我遇到了一些困难。我虽然我的.yml文件设置正确使用java 8,但我收到的错误说不然。
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认识到我正在使用java 8,但travis正在编译1.5。我无法找到任何关于如何改变它的内容,任何帮助都会受到赞赏。
答案 0 :(得分:1)
你的travis.yml是什么样的?
这是我的前三行,这对我来说很好(我使用的是gradle而不是maven)
language: java
jdk:
- oraclejdk8
你将不得不为任何人提供更多信息来帮助解决这个问题。
作为参考,这是我的完整travis.yml以供参考。
答案 1 :(得分:-1)
我解决了在我的.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>
这两种方法都适用于我。