I am trying to build hadoop from source as explained in this article. When building Apache common, everything fails with this error message: command line too long.
So, Here's what I have tried(I will update this when I try more):
- As said in this
Stackoverflow answer, the way to overcome this error is to shorten the path as much as possible. So, I cut repository files from 
C:\user_name\.m2\repository\to another directory and made an empty drive and have that point to this new directory which i have moved files to, like thissubst M: D:\maven-2.0.8\repositoryand changed<localRepository>M:</localRepository>tag in "settings.xml" fromC:\apache-maven-2.0.8\confto point toM:. And after doing all this, I restart my system and try to build hadoop again. But, as I can see from the error, maven still downloads packages toC:\Users\user_name\.m2\repository\, notM:and the error ofcommand line too longerror persists. - To shorten the path as much as possible, i made a directory in 
C:\mrepoand have this directory symbolically link to theC:\user_name\.m2\repository\like this:mklink /J C:\mrepo C:\Users\.m2\repository. And after doing all this, I restart my system and try to build hadoop again. But, as I can see from the error, maven still downloads packages toC:\Users\user_name\.m2\repository\, notM:and the error ofcommand line too longerror persists. 
EDIT 1:
- I have also set an environment variable named 
M2_HOMEwith valueM:\. And made changes in my \conf\settings.xml:<localRepository>${M2_HOME}</localRepository>. The issue still persisits. 
How do I fix this and build hadoop successfully?