Small Problem with Maven 2 and Eclipse

In an effort to prepare myself for potentially adding some Maven-based projects to our AntHill Pro system at work I grabbed the Apache Maven 2 Reference Card from Refcardz. It was a good overview but didn’t include some of the basics,  like creating a basic project. Maven in 5 Minutes on the Maven web site proved more useful for that, as did the Guide to using Eclipse with Maven 2.x.

I used MacPorts to install Maven with the following:

sudo port install maven

I created a simple project using the following:

mvn archetype:create -DgroupId=org.spilth.rpgam -DartifactId=rpgam

And then tried to generate an Eclipse project file using:

cd rpgam
mvn eclipse:eclipse

The command failed with the following error in the output:

[WARNING] Unable to get resource ‘jline:jline:jar:0.9.1′ from repository central (http://repo1.maven.org/maven2): Specified destination directory cannot be created: /Users/brian/.m2/repository/jline/jline/0.9.1

It suggested I manually download and install jline. I was not down with this because, well, I thought Maven was supposed to take care of this stuff for me – I shouldn’t have to manually download and install stuff!

Upon looking in my ~/.m2/repository directory I noticed that some directories were owned by root and some by me. I’m not sure how or when this happened but I fixed it with the following:

sudo chown -R brian /Users/brian/.m2/

This fixed the problem and successfully created a .classpath and .project file for Eclipse.

I also started my own Maven cheat sheet.

Lastly, I learned that you an open a Finder window for the current directory from Terminal by using:

open .