Maven is one of those tricky little tools that I avoided moving to, because it looked a little complicated with its xml file and declarative nature, whereas with Ant it was nice and procedural and easy to understand.
I’ve grown to appreciate how simple maven allows me to keep my project, and I often avoid libraries that don’t publish themselves as maven dependencies because then I have to manage them myself.
But, sometimes when I’m setting up a new install I forget how little information a user receives to help debugging, when using it.
A couple of days ago I setup maven. The environment variables M2, M2_HOME all failed to work properly because of machine security settings I think. I tend not to waste time debugging this stuff any more, I’ll stick an absolute path in for all the variables, and add the absolute path to the PATH itself. IntelliJ didn’t pick up maven automatically so I added it manually into the IntelliJ config.
And when I ran a “mvn clean” I got download issues.
I visited the url in the repo through the browser and received a 404, which initially made me think that the file was missing, but in reality I had to amend the settings.xml and add a proxy.
The settings.xml is in maven install directory
<proxy> <id>myproxy</id> <active>true</active> <protocol>http</protocol> <host>184.108.40.206</host> <port>80</port> <nonProxyHosts></
nonProxyHosts> </proxy> Note I just made up the host IP
Note I just made up the host IP address there.
If you need to you can add a username and password in there as well. But try without it first.
My Full Online WebDriver course has some Maven FAQ and Troubleshooting tips available as free preview content, and the proxy stuff is actually covered in the 3rd lecture listed below:
- Maven FAQs and Troubleshooting Tips
- Maven Troubleshooting Downloads
- Maven Troubleshooting Proxies and Download Cache Issues
There is a useful post on StackOverflow that describes the maven proxy fix: