哈德逊错误:M2_HOME设置为无效的目录 [英] Hudson ERROR: M2_HOME is set to an invalid directory

查看:348
本文介绍了哈德逊错误:M2_HOME设置为无效的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有Windows 7的计算机。在其上我已经安装了Hudson。我已经安装了一段时间了,到现在为止已经很好了。



有些事情发生了变化。现在,每当我尝试构建一个项目,在SVN成功检出项目后,就会失败,并显示以下消息:

  ERROR :M2_HOME设置为无效目录。 
M2_HOME =C:\Build\Hudson\.hudson\jobs\Score_Plugin\workspace\ ..
请在您的环境中设置M2_HOME变量以匹配
Maven安装位置

我不知道为什么会给我这个错误。为什么哈德森试图在自己的工作区中找到M2_HOME?我试过以下,这似乎说我的环境中的Maven安装很好:



1。我打开了一个CMD并输入mvn,并得到以下内容:

  C:\Build\Maven\\ \\apache-maven-3.0.5\bin\mvn 
C:\Build\Maven\apache-maven-3.0.5\bin\mvn

2。我输入'mvn -version'并得到这个:

  Apache Maven 3.0.5< r01de14724cdef164cd33c7c82fe155faf9602da; 2013-02-19 05:51:28-0800> 
Maven主页:C:\Build\Maven\apache-maven-3.0.5
Java版本:1.7.0_25,供应商:Oracle Corporation
Java home:C:\ Build \Java\jdk1.7.0_25_x64\jre
默认语言环境:en_US,平台编码:Cp1252
操作系统名称:windows 7,版本:6.1,arch:amd64家庭:windows

3。我检查了,我有一个'MAVEN_HOME'环境变量设置为'C:\Build\Maven\apache-maven-3.0.5`。
我还有`%MAVEN_HOME%\bin



看起来我的环境正在工作。



4。为了解决这个错误,我创建了一个 M2_HOME 环境变量,并将其设置为等于%MAVEN_HOME%。 / p>

5。要重新启动它,我重新启动了我的机器。



我还在收到这个错误。我正在为每个我尝试在哈德森建立的项目找到它。我不知道我还能做什么任何想法?

解决方案

我不知道为什么这样工作,但是这样做。



根据sbk的评论建议,我去了构建配置。我点击高级查找使用私人Maven仓库选项。





我预计会看到这个选项被选中,因为这将解释问题。但是不是。我没想到会有所帮助,但是我选择了这个选项,只是为了看看会发生什么:





令人惊讶的是,它的工作!我的项目在哈德森再次建成。我仍然不知道是什么原因造成了这个问题,或者为什么这样做是固定的,但是由于这样做是对我的答案,除非有人可以解释为什么这个工作。


I am using a computer with Windows 7. On it I have Hudson installed. I have had this installation for a while, and it has been working fine up till now.

Something has changed. Now, whenever I try to build a project, after successfully checking out the project from SVN, it fails with this message:

ERROR: M2_HOME is set to an invalid directory.
M2_HOME = "C:\Build\Hudson\.hudson\jobs\Score_Plugin\workspace\.."
Please set the M2_HOME variable in your environment to match the
location of the Maven installation

I cannot figure out why it is giving me this error. Why is Hudson trying to find M2_HOME in its own workspace? I tried the following, which seems to say that my Maven installation in my environment is just fine:

1. I opened up a CMD and typed in `where mvn` and got the following:

C:\Build\Maven\apache-maven-3.0.5\bin\mvn
C:\Build\Maven\apache-maven-3.0.5\bin\mvn

2. I typed in `mvn -version` and got this:

Apache Maven 3.0.5 <r01de14724cdef164cd33c7c82fe155faf9602da; 2013-02-19 05:51:28-0800>
Maven home: C:\Build\Maven\apache-maven-3.0.5
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Build\Java\jdk1.7.0_25_x64\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

3. I checked to see, and I have a `MAVEN_HOME` environment variable set to `C:\Build\Maven\apache-maven-3.0.5`.
I also have `%MAVEN_HOME%\bin` in my path.

It looks like my environment is working.

4. In an attempt to solve this error, I created a M2_HOME environment variable and set it equal to %MAVEN_HOME%.

5. To top it all off, I've rebooted my machine.

I'm still getting this error. I'm getting it for every project I try to build in Hudson. I'm not sure what I else I can do. Any ideas?

解决方案

I am not sure why this worked, but it did.

As suggested by sbk's comment, I went to the build configuration. I clicked "advanced" to look for the `Use private Maven repository` option.

I expected to see this option selected as it would explain the problem. But it wasn't. I didn't expect it would help, but I selected the option anyway just to see what would happen:

Amazingly, it worked! My project builds again in Hudson. I still don't know what caused this problem in the first place, or why this fixed it, but since it did this is the answer for me unless someone else can explain why this worked.

这篇关于哈德逊错误:M2_HOME设置为无效的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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