Java Travis CI JDK设置为oraclejdk8,但得到的错误表明源代码为1.5
我很难让Travis CI运行。我认为我的.yml文件被正确地设置为使用Java8,但我得到了相反的错误Java Travis CI JDK设置为oraclejdk8,但得到的错误表明源代码为1.5,java,travis-ci,Java,Travis Ci,我很难让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) Mave
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。我在任何地方都找不到任何关于如何改变这一点的信息,如果有任何帮助,我将不胜感激。你的travis.yml是什么样子的 这是我的前三行,这对我来说很好(我使用的是gradle而不是maven)
语言:java
jdk:
-oraclejdk8
你必须向任何人提供更多的信息来帮助这一点
这是我的全部参考资料。你的travis.yml是什么样子的 这是我的前三行,这对我来说很好(我使用的是gradle而不是maven)
语言:java
jdk:
-oraclejdk8
你必须向任何人提供更多的信息来帮助这一点
作为参考,这是我的完整参考。我解决了一个类似的问题,在.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>
maven编译器插件
3.3
1.8
1.8
这两种方法都适用于我。我解决了一个类似的问题,在.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>
maven编译器插件
3.3
1.8
1.8
这两种方法都适用于我。您需要在POM的编译器插件配置中设置Java版本。您需要在POM的编译器插件配置中设置Java版本。