Wednesday Jan 06, 2010

10 Steps to Get Started with Maven on the NetBeans Platform

Aside from the (currently) missing exhaustive reference material for the NetBeans Platform (mitigated by the NetBeans API javadoc and Essential NetBeans Platform Reference Card), the other BIG gap in the NetBeans Platform documentation is... everything relating to Maven. Much can be discovered via google (e.g., type the following keywords in google "NetBeans Platform Maven" and/or "NetBeans RCP Maven").

However, the official docs all assume you're using Ant to build your application. Time to fix that.

Here's a start. Simple NetBeans Platform "getting started" scenario (plus some interesting benefits over Ant) via Maven and a bunch of screenshots.

  1. Go to the New Project wizard, choose the Maven project type, and click Next:

  2. Choose the Maven NetBeans Platform Application Archetype and click Next:

  3. Enter a name for your application and other stuff, including a main package, which (just for fun) I have here specified to indicate that this application is being developed for the Skyguide team (visited by Toni and myself last year and they're doing great with the NetBeans Platform, last I heard):

  4. Click Finish and then the IDE shows you the project structure of the folders and files that have been created on disk:

  5. However, maybe you reckon that IntelliJ IDEA provides a better perspective. No worries, just open the 'pom.xml' file created for the application into the (free!) community edition of IntelliJ IDEA and then you're good to go:

    Note: Follow these steps to set up the classpath correctly for using the NetBeans Platform in IntelliJ IDEA.

  6. Use the "New Window Component" wizard in NetBeans IDE to create a new window in the application:

  7. Run the application (from wherever you like, including the command line), open a few windows, and here's the starting point of the brilliant application you're about to create:

  8. Ask yourself this simple question: "How much coding have I done to get to the above state of my application?"


  9. Then use the Matisse GUI Builder in NetBeans IDE to add UI elements to the window you generated earlier.

  10. Next, if that's your preference, use IntelliJ IDEA again for the coding of the business logic of your application. I.e., in this scenario, NetBeans IDE is a simplistic code generator, while IntelliJ IDEA is your code editor. The dependency graph for Maven applications is fun too:

Hurray, you're up and running with the NetBeans Platform for Maven-based applications! What should be addressed next in this Maven-based series of blog entries? Tell me and I will write it!


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« January 2010 »