-1

在我确定之前,已经以多种方式提出了这个问题。

我的环境细节:

以下提交审核(太大,无法在此处粘贴和格式化):

以下是我验证的关于我的环境的一些事情......

[jenkins@lx64etseapp04 workspace]$ set | grep JAVA
JAVA=/usr/java/jdk1.6.0_45/bin
JAVA_HOME=/usr/java/jdk1.6.0_45

[jenkins@lx64etseapp04 workspace]$ mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 05:51:28-0800)
Maven home: /opt/apache-maven-3.0.5
Java version: 1.6.0_45, vendor: Sun Microsystems Inc.
Java home: /usr/java/jdk1.6.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.11.1-200.fc19.x86_64", arch: "amd64", family: "unix"

[jenkins@lx64etseapp04 workspace]$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

[jenkins@lx64etseapp04 workspace]$ javac -version
javac 1.6.0_45

[jenkins@lx64etseapp04 workspace]$ which java
/usr/java/jdk1.6.0_45/bin/java

[jenkins@lx64etseapp04 workspace]$ set | grep PATH
PATH=/usr/java/jdk1.6.0_45/bin:/opt/TEE-CLC-11.0.0:/opt/apache-maven-3.0.5/bin:   /usr/java/jdk1.6.0_45/bin:/opt/apache-ant-1.9.2/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/var/lib/jenkins/.local/bin:/var/lib/jenkins/bin
QT_PLUGIN_PATH=/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins
local cmd PATH=$PATH:/sbin;
if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then
for i in ${CDPATH//:/'
PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &>/dev/null
COMPREPLY=($( compgen -W "$( PATH="$PATH:/sbin" lsmod |         awk '{if (NR != 1) print $1}' )" -- "$1" ))
local PATH=$PATH:/sbin;
local PATH="$PATH:/sbin:/usr/sbin";
COMPREPLY+=($( compgen -W         "$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ))
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin;
COMPREPLY+=($( compgen -W         "$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ))

[jenkins@lx64etseapp04 workspace]$ uname -r
3.11.1-200.fc19.x86_64

[jenkins@lx64etseapp04 workspace]$

更新 我认为我的问题可能与 maven-compiler-plugin 有关,但我不能排除环境配置。如上所示,maven-compiler-plugin 失败。

为什么 Maven 说它想使用 JRE 而不是 JDK? JDK确实安装了!

这是一些mvn -X输出...

[DEBUG] Configuring mojo org.apache.maven.plugins:maven-compiler-plugin:3.1:compile from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-compiler-plugin:3.1, parent: $
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:3.1:compile' with basic configurator -->
[DEBUG]   (f) basedir = /var/lib/jenkins/jobs/ETSE(3.0.x)-JavaProjects/workspace/common
[DEBUG]   (f) buildDirectory = /var/lib/jenkins/jobs/ETSE(3.0.x)-JavaProjects/workspace/common/target
[DEBUG]   (f) classpathElements = [/var/lib/jenkins/jobs/ETSE(3.0.x)-JavaProjects/workspace/common/target/classes, /var/lib/jenkins/.m2/repository/com/etp/commons/commons-log-persi$
[DEBUG]   (f) compileSourceRoots = [/var/lib/jenkins/jobs/ETSE(3.0.x)-JavaProjects/workspace/common/src/main/java]
[DEBUG]   (f) compilerArgument = -Xlint:all
[DEBUG]   (f) compilerId = javac
[DEBUG]   (f) compilerVersion = 1.6
[DEBUG]   (f) debug = true
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) failOnError = true
[DEBUG]   (f) forceJavacCompilerUse = false
[DEBUG]   (f) fork = true
[DEBUG]   (f) generatedSourcesDirectory = /var/lib/jenkins/jobs/ETSE(3.0.x)-JavaProjects/workspace/common/target/generated-sources/annotations
[DEBUG]   (f) maxmem = 512m
[DEBUG]   (f) meminitial = 128m
[DEBUG]   (f) mojoExecution = org.apache.maven.plugins:maven-compiler-plugin:3.1:compile {execution: default-compile}
[DEBUG]   (f) optimize = false
[DEBUG]   (f) outputDirectory = /var/lib/jenkins/jobs/ETSE(3.0.x)-JavaProjects/workspace/common/target/classes
[DEBUG]   (f) projectArtifact = com.etse:etse-common:jar:3.0.3-SNAPSHOT
[DEBUG]   (f) showDeprecation = true
[DEBUG]   (f) showWarnings = true
[DEBUG]   (f) skipMultiThreadWarning = false
[DEBUG]   (f) source = 1.6
[DEBUG]   (f) staleMillis = 0
[DEBUG]   (f) target = 1.6
[DEBUG]   (f) useIncrementalCompilation = true
[DEBUG]   (f) verbose = true
[DEBUG]   (f) mavenSession = org.apache.maven.execution.MavenSession@2df30035
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@2df30035
[DEBUG] -- end configuration --
[DEBUG] Using compiler 'javac'.
[DEBUG] Source directories: [/var/lib/jenkins/jobs/ETSE(3.0.x)-JavaProjects/workspace/common/src/main/java]
4

2 回答 2

1

mvn --version输出来看,它正在使用您告诉它使用的 Java 安装;即你安装的那个/usr/java/jdk1.6.0_45

为什么 Maven 说它想使用 JRE 而不是 JDK?

它不是这么说的。它只是告诉您它已将其 JAVA_HOME 变量设置为什么,并且该设置对于 JDK 安装看起来是正确的。

我希望您的 maven-compiler-plugin 失败的原因是其他原因。但是您没有包括确定那是什么所需的信息。应该有一些较早的输出(列出编译错误!)。如果这没有帮助,请mvn使用该选项重新运行命令-e(如插件失败消息所建议的那样!!)并告诉我们它所说的内容。


一般来说,如果过早关注某个特定理论来说明构建失败的原因是一个主意,而只向您想要帮助您的人展示与您的理论相关的证据则是一个更糟糕的主意。

于 2013-09-28T01:02:33.423 回答
0

这篇文章为我的特定环境和多模块 Maven 构建所需的修复提供了线索。

我降级了maven-compiler-pluginfrom 3.1to的版本,2.3.2我的构建继续没有失败。

不确定真正的根本原因是什么(猜测编译器警告可能被视为错误)。 mvn -e对我不是很有帮助,mvn -X. 经过多次谷歌搜索尝试后,我才找到上述帖子。

于 2013-09-28T18:01:16.217 回答