默认情况下,我了解了wildfly 8.1.0
卡匣supports JDK 8
但是,当我部署我的应用程序时,我看到以下错误
remote: Stopping wildfly cart
remote: Repairing links for 1 deployments
remote: Building git ref master, commit af5f0d3
remote: Found pom.xml... attempting to build with mvn -e clean package -Popenshift -DskipTests
remote: Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)
remote: Maven home: /usr/share/java/apache-maven-3.0.4
remote: Java version: 1.7.0_65, vendor: Oracle Corporation
remote: Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65/jre
remote: Default locale: en_US, platform encoding: ANSI_X3.4-1968
remote: OS name: linux, version: 2.6.32-431.23.3.el6.x86_64, arch: i386, family: unix
remote: [INFO] Scanning for projects...
remote: [INFO]
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] Building pennyapp 1.0-SNAPSHOT
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO]
remote: [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ pennyapp ---
remote: [INFO]
remote: [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ pennyapp ---
remote: [debug] execute contextualize
remote: [WARNING] Using platform encoding (ANSI_X3.4-1968 actually) to copy filtered resources, i.e. build is platform dependent!
remote: [INFO] skip non existing resourceDirectory /var/lib/openshift/53ec289c5973ca0333000a6c/app-root/runtime/repo/src/main/resources
remote: [INFO]
remote: [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ pennyapp ---
remote: [INFO] Changes detected - recompiling the module!
remote: [WARNING] File encoding has not been set, using platform encoding ANSI_X3.4-1968, i.e. build is platform dependent!
remote: [INFO] Compiling 1 source file to /var/lib/openshift/53ec289c5973ca0333000a6c/app-root/runtime/repo/target/classes
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] BUILD FAILURE
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] Total time: 5.602s
remote: [INFO] Finished at: Sat Aug 16 00:54:13 EDT 2014
remote: [INFO] Final Memory: 7M/111M
remote: [INFO] ------------------------------------------------------------------------
remote: [WARNING] The requested profile openshift could not be activated because it does not exist.
remote: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project pennyapp: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
remote: [ERROR]
remote: [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote: [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote: [ERROR]
remote: [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
remote: An error occurred executing gear postreceive (exit code: 1)
remote: Error message: CLIENT_ERROR: Failed to execute: control build for /var/lib/openshift/53ec289c5973ca0333000a6c/wildfly
remote:
正如您所看到的那样,日志清楚地说明了
remote: Java version: 1.7.0_65, vendor: Oracle Corporation
为了确认这一点,我登录了Openshift框并看到了这个
[api-myapp.rhcloud.com 53ec5973ca0333000a6c]\> java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) Server VM (build 25.5-b02, mixed mode)
和
[api-myapp.rhcloud.com 53ec5973ca0333000a6c]\> mvn -version
Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)
Maven home: /usr/share/java/apache-maven-3.0.4
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.23.3.el6.x86_64", arch: "i386", family: "unix"
问题?
Maven使用java版1.7.0_65
问题?
如何告诉maven使用java 1.8?
我在mac上使用命令行知道了一种方法
export JAVA_HOME=$(/usr/libexec/java_home)
但是有没有更好的方法,所以在设置Continuous Deployment
时我不必乱动?
由于
更新 - 1
我还看到JAVA_HOME
已正确设置
echo $JAVA_HOME
/var/lib/openshift/53ec289c5973ca0333000a6c/wildfly/usr/lib/jvm/jdk1.8.0_05
更新 - 2
我的pom.xml
,我的插件定义为
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${javac.version}</source>
<target>${javac.version}</target>
</configuration>
</plugin>
和
<properties>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
<javac.version>1.8</javac.version>
<maven-sortpom-plugin.version>2.3.0</maven-sortpom-plugin.version>
</properties>
更新 - 3
更多指针
[api-myapp.rhcloud.com repo]\> echo $PATH
/var/lib/openshift/53ec289c5973ca0333000a6c/wildfly/usr/lib/jvm/jdk1.8.0_05/bin:/etc/alternatives/maven-3.0/bin:/var/lib/openshift/53ec289c5973ca0333000a6c/wildfly//bin/tools:/bin:/usr/bin:/usr/sbin
[api-myapp.rhcloud.com repo]\> which java
/var/lib/openshift/53ec289c5973ca0333000a6c/wildfly/usr/lib/jvm/jdk1.8.0_05/bin/java
[api-myapp.rhcloud.com repo]\> /usr/bin/java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-i386 u65-b17)
OpenJDK Server VM (build 24.65-b04, mixed mode)
[api-pennyapp.rhcloud.com repo]\>
答案 0 :(得分:1)