You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 27 Next »

Short Instructions

  1. Download Maven 2
  2. Add the Maven 2 bin directory to the PATH variable.
  3. Download Netbeans.
  4. Install Netbeans
  5. Install the Maven Plugin in Netbeans at Tools > Plugins > Available Plugins.
  6. Checkout a project with Versioning > CVS > Checkout.

Long Instructions

Maven 2 Installation

On Linux, an appropriate version of Maven 2 can be installed as follows.

wget http://www.lcsim.org/dist/maven2/2.0.9/apache-maven-2.0.9-bin.zip
unzip apache-maven-2.0.9-bin.zip

Now, the environment needs to be setup so Netbeans finds this external Maven version. The Maven bin directory must be added to the system path.

Linux Environment

This will add the bin directory to the path on Linux using bash.

export M2_HOME=/path/to/apache-maven-2.0.9
export PATH=$M2_HOME/bin:$PATH

It can be placed in the RC file for your shell so that this is setup when you login.

Windows Environment

Open the System menu under Control Panel > System (the icon looks like a computer). Go to the Advanced tab under System and click on Environment Variables.

Under the System Variables area, select the Path record and click Edit.

Hit the End key to go to the end of the text box.

Now add the Maven 2 bin directory to the Path. The easiest way to do this is by navigating to the bin directory in Explorer and then copying the full path from the address bar into the Path (using Ctrl+c, Ctrl+v). The path items are separated by semi-colons so make sure to put a semi-colon in front of the new entry.

Maven 2 Plugin

Install the Maven Plugin in Netbeans at Tools > Plugins > Available Plugins.

Click Next to continue.

Click Install to continue.

Click Finish to complete the installation.

The Maven plugin should show in the Installed tab.

Project Setup

Now that Netbeans is correctly configured, we can checkout and build a Java project.

Checkout the lcsim-contrib project from the SLAC CVS. The user name "jeremy" should be replaced with your cvs account name, and the password should be replaced with your cvs password.

Type lcsim-contrib into the Module text box and click Finish.

Now have Netbeans import this checkout as a project by clicking on Open Project.

The project can be built in the standard way by right clicking on it and selecting Build.

If you managed to setup everything correctly, the build message in the log should be something like the following.

NetBeans: Executing 'mvn install'
NetBeans:      JAVA_HOME =/nfs/slac/g/lcd/mc/prj/sw/extern/jdk/pro
Scanning for projects...
------------------------------------------------------------------------
Building org.lcsim Contrib Packages
   task-segment: [install]
------------------------------------------------------------------------
[resources:resources]
Using default encoding to copy filtered resources.
snapshot org.lcsim:lcsim:1.6-SNAPSHOT: checking for updates from lcsim-maven
snapshot org.lcsim:GeomConverter:1.5-SNAPSHOT: checking for updates from lcsim-maven
snapshot org.lcsim:GeomConverter:1.5-SNAPSHOT: checking for updates from freehep-maven
[compiler:compile]
Compiling 20 source files to /a/surrey01/vol/vol2/g.lcd.mc/prj/users/jeremym/lcsimTut/nbProjects/lcsim-contrib/target/classes
[resources:testResources]
Using default encoding to copy filtered resources.
[compiler:testCompile]
No sources to compile
[surefire:test]
No tests to run.
[jar:jar]
Building jar: /a/surrey01/vol/vol2/g.lcd.mc/prj/users/jeremym/lcsimTut/nbProjects/lcsim-contrib/target/lcsim-contrib-1.0-SNAPSHOT.jar
[install:install]
Installing /a/surrey01/vol/vol2/g.lcd.mc/prj/users/jeremym/lcsimTut/nbProjects/lcsim-contrib/target/lcsim-contrib-1.0-SNAPSHOT.jar to /u/ey/jeremym/.m2/repository/org/lcsim/lcsim-contrib/1.0-SNAPSHOT/lcsim-contrib-1.0-SNAPSHOT.jar
[freehep-jas:install {execution: default}]
Copied 1 jar file to /u/ey/jeremym/.JAS3/extensions
------------------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------------------
Total time: 12 seconds
Finished at: Thu Dec 11 15:26:13 PST 2008
Final Memory: 17M/193M
------------------------------------------------------------------------
  • No labels