Maven指向JRE而不是jdk [英] Maven pointing to JRE instead of jdk

查看:3359
本文介绍了Maven指向JRE而不是jdk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在与一位同事一起解决我刚刚加入的一个新项目遇到的问题。长话短说,maven没有正确构建我的.war文件。当我给我的同事我的战争文件时,他遇到了同样的问题,当他给我他编译的.war文件时,一切正常。我们都在使用相同的来源。因此,我正在尝试正确设置maven(与他相同),我们现在都拥有相同版本的maven。但是,我认为maven正在错误地查看java_home。

I've been working with a co-worker on a problem I have been experiencing on a new project I just joined. Long story short, maven isn't building my .war file correctly. When I give my co-worker my war file, he experiences the same problem I have, and when he gives me his compiled .war file, everything works. We are both working with the same source. So, I am trying to get maven setup correctly (the same as his), we both have the same version of maven now. However, I think maven is looking at the java_home incorrectly.

当我执行mvn -version命令时,我得到以下结果:

when I do an mvn -version command, I get the following:

C:\java\KME_workspace\CU-KME>mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: C:\java\tools\apache-maven-3.0.4
Java version: 1.6.0_45, vendor: Sun Microsystems Inc.
Java home: C:\java\jdks\jdk1.6.0_45\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

我的系统的JAVA_HOME变量是否正确设置到C:\ java \ jdks \ jdk1.6.0_45。

My system's JAVA_HOME variable is set correctly to C:\java\jdks\jdk1.6.0_45.

任何人都知道我的maven正在看jre,我该怎么设置正确回到jre JDK?我也可能正确地看待问题,所以如果你有任何想法,那就太棒了。

Anyone know my maven is looking at the jre, and how do I set it correctly back to the JDK? It's possible I am looking at the problem in correctly too, so if you have any ideas, that would be great.

谢谢。

正如一些人所说,maven版本中java home中的JRE引用是我的一个红色鲱鱼兔洞。经过进一步测试,我有一些新的有趣信息。我直接从命令行运行maven命令。我使用eclipse从我们的svn存储库中检出代码,并尝试在该代码上运行maven包,并且.war无法正确构建。但是,如果我在eclipse中将团队导出到新目录,并在其上运行maven包,它会构建.war罚款并且工作正常。据我了解,eclipse中的团队导出会删除导出目录中的所有subversion文件。人对如何解决这个

As some noted, the JRE reference in the java home in the maven version was a red herring rabbit hole on my part. Upon further testing I have some new interesting information. I am running maven commands directly from the command line. I check out code from our svn repository with eclipse, and try to run a maven package on that code, and the .war doesn't build correctly. However, if I do a team export in eclipse to a new directory, and the run the maven package on that, it builds the .war fine and works perfectly. As I understand it, the team export in eclipse removes all the subversion files in the exported directory. Anyone have any ideas on how to solve this?

推荐答案

从的 Maven属性指南:


$ {java.home}指定路径当前JRE_HOME环境
使用相对路径获取例如:
$ {java.home} ../ bin / java.exe

${java.home} specifies the path to the current JRE_HOME environment use with relative paths to get for example: ${java.home}../bin/java.exe

java.home 属性与JAVA_HOME环境设置不同。它实际上是动态属性,显示哪个JRE正在运行您的代码。

java.home property is not the same thing as JAVA_HOME environment setting. It is actually dynamic property showing you which JRE is running your code. 

尝试正确设置java.home属性并查看它是否有效。

Try setting the java.home property correctly and see if it works.

这篇关于Maven指向JRE而不是jdk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆