Maven is Magic in NetBeans IDE 6.0!

I came across Mark Ashworth's Connext-Graphs project a few days ago and then found that the project sources, including samples, are provided as Maven projects. Mark told me that I would first need to do a "mvn install" on the main project, after which I would be able to build the other project, i.e., the one that provides samples. So, being ignorant of Maven and all it entails, I thought: "Hmmm. I guess I'll go to the Synaptic Package Manager and see if I can find Maven there." I also googled around a bit. Guess what I discovered...

Of course, I was aware of the fact that there's a NetBeans plugin for Maven. However, I assumed I'd need to install some command line tool first, which would then need to be registered in the IDE, after I'd installed the Maven plugin. At some point, I thought: "Maybe I'll install the Maven plugin first. Then I'll look for the place where I need to register the command line tool and go from there." So I went to the IDE's Plugin Manager, searched for Maven, and then had it installed 3 seconds later.

Next, I went to the New Project wizard. I thought: "Maybe I'll be able to import the Maven projects that I've downloaded from Mark's site. Once I've imported them, maybe I'll be able to build." Sure enough, I found a project type for importing Maven projects:

I clicked Next. Guess what I found? A message telling me: "Hey buddy, you don't need to import at all. Just open the project, NetBeans is smarter than you think!" Or, words to that effect:

So, I could simply open both projects, without doing anything special at all. I chose File | Open Project and then browsed to where I'd downloaded the projects from the dev.java.net site. I found that the IDE recognized the projects, because the typical NetBeans project icon showed for both of them and I thus was able to open them. Once opened in the IDE, they look like this:

And... there are contextual menu items for tasks such as building the projects:

In the end, I didn't need to do anything at all. I simply opened the projects, built them, and then ran the samples. It was an utterly boring experience, I had no issues to file in Issuezilla and I had no problems to solve at all, in any shape or form. Life sucks sometimes.

 

0

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Anuradha Gunasekara replied on Fri, 2008/02/15 - 3:58pm

Hey Geertjan last January I joined to MevenIDE Project and  I'm working with Milos on MevenIDE 3.1 version there are more Magic on the way :)

Just check out Snapshot version at deadlock

http://deadlock.netbeans.org/hudson/job/mevenide/lastSuccessfulBuild/artifact/mevenide-SNAPSHOT.zip

Anuradha G

Dirk replied on Mon, 2008/02/18 - 10:23am

Hi! Do you happen to know if its possible to have Maven2 build with a different JDK than the one NetBeans was started with? I need this feature since I develop on MacosX 10.5 and there is no 1.6 JDK from Apple yet. The Soylatte JDK has no Aqua. So I build with JDK 1.6 but need to run Netbeans in JDK 1.5 Last time I checked Netbeans 6.0, it was impossible to use Soylatte for Maven but not the Netbeans IDE. Regards, Dirk

Milos Kleint replied on Wed, 2008/02/20 - 3:00am in response to: biafra

You need to configure maven-compiler-plugin to use different compiler binary. inthe future when maven starts supporting toolchains in plugins, this might get a bit easier but it's still mainly maven configuration (which is now workarounded on command line by running maven itself with required jdk)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.