I am using a computer with Windows 7, and I have Hudson installed on it. 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?
Use private Maven repository
= true? The documentation for that option saysWhen this option is checked, Hudson will tell Maven to use $WORKSPACE/.repository as the local Maven repository
. Its seems feasible that hudson might do this overwriting the value of M2_HOME similar to as you are seeing. – sbk