Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Info
titleJava 1.5 Required

Make sure you have You must use a Java 1.5.0 JDK, because org.lcsim requires it.

I will also briefly describe how to import and build a Maven-based project within Netbeans.

Tipwarning
titleSoftware DirectoryWarning

These linux specific instructions are not up-to-date. You should just follow the generic instructionsI'll assume that all your software is based at $SW so that script examples are concise and clear.

Downloads

Java

Java 1.5.0 can be downloaded at http://java.sun.com/j2se/1.5.0/download.jsp.Make sure to set

Info
titleJAVA_HOME

Set the JAVA_HOME variable to your JDK root area. Otherwise, Maven may not pick up the correct Java compiler.

At SLAC, you can setup the shared Java 1.5.0 JDK on Linux by executing this command.

No Format

export JAVAVER=1.5

Netbeans Installer

Get the install files for Netbeans from http://www.netbeans.org/index.html.

...

No Format
wget http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-1.0.2.tar.gz

Maven NBM

Mevenide provides Maven support in the Netbeans IDE. You need to get the "nbm" files for Maven support within Netbeans.from the Mevenide Downloads Area .

download

No Format
wget http://mevenide.codehaus.org/download/mevenide-netbeans-autoupdate-1.0.nbm
wget http://mevenide.codehaus.org/download/mevenide-netbeans-grammar-0.6.1.nbm
Note
titleGrammar NBM Might be Optional

As of now, if you want to install the most recent Netbeans, 4.1beta, you will need the special NBM file for XML grammar listed above. If, instead, you choose to use 4.0, you may not need to install the grammar pack separately. Thus, the instructions throughout this guide about this special setup should be ignored if you are using Netbeans 4.0 and not 4.1beta.

Summary

You should now have the following files for the installation.

No Format
mevenide-netbeans-autoupdate-1.0.nbm
mevenide-netbeans-grammar-0.6.1.nbm
netbeans-4_1-beta-linux.bin
maven-1.0.2.tar.gz

...

Warning
titleMaven Mispelled

"maven" has been mispelled as "meven"

...

throughout the Maven IDE installation kit.

Obviously, the exact versions will change as Netbeans and Maven are updated.

...

Step through the wizard, selecting a location where you won't go over disk quota.

Make sure to select a Java 1.5.0 JDK.

For instance, this shows the shared install used at SLAC.

Image Added

When finished, startup NetbeansStart Netbeans in order to install the Maven IDE support.

No Format
netbeans-4.1beta/bin/netbeans

...

Warning
titleCareful when Installing Modules

I noticed that if the module installation steps were performed incorrectly, Netbeans would often complain once at restart about missing dependencies and then not allow reinstallation of the modules using the Update Manager, at least not in an obvious way. So be careful and make sure you try to do it correctly the first time, or Netbeans may need to be reinstalled entirely. (Probably, there is a way to have it rescan modulesfor module updates, but I have not found it.)

Now you need to install Maven grammar support. This is a version The one you downloaded is especially for Netbeans 4.1beta.

...

Click Add and select the file mevenide-netbeans-grammar-0.6.1.nbm. Click Okay. You should see this file under Modules to Install.

Image Added

Click Next.

You should see Meven IDE XML Grammar under Include in Install on the lefthand side.

Image Added

Click Next.

Now select the boxes under Include and Global for Meven IDE XML Grammar. Click Accept or Yes to get past the boilerplate warnings.

Image Added

Click Next.

Info
titleGlobal Install

It is my preference to put the Maven IDE support in the Netbeans install area, i.e. Global, but it is not necessary for the install to work.

...

Go back to Tools -> Update Center and select Check the Web .... Deselect Development Update Center and make sure that Mevenide Update Center is selected.

Image Added

Click Next.

Under Available Updates and New Modules, you should see a number of modules under Mevenide Update Center. Click the Double Arrow to put these all into Include in Install. Now use the Single Arrow to deselect the installation of Mevenide-Grammar, as you installed this previously.

Image Added

Click Next and finish the installation exactly as before, making sure to select Include for all modules in the Modules to Install box.

...

You can open an existing Maven project using File -> Open Project. Valid folders will have a yellow box on them. Select one in the lower right of the folder icon. For instance, I could choose the GeomConverter or lcsim folders below.

Image Added

Select a valid folder in the chooser window and click Open Project Folder.

Netbeans will now scan the project for classes and the like, which takes awhile. Once it is finished, you should see the project in the lefthand window.

Here is the GeomConverter project with some expanded folders.

Image Added

Building the Project

To build the project using Maven, simply right click on the project in the lefthand pane and click Build.

Image Added

Alternately, you can select the menu item Build -> Build Main Project or press F11.

You should see the Maven splash screen in the console and scrolling messages as the project is built.

Image Added

Congratulations, you now have Maven support in Netbeans.