Step-by-step instructions for getting Maven up and running to support your Jive SBS development.

Current Maven Version: 2.0.9

Use other versions at your peril.

Note:  Mac OSX comes pre-installed with a copy of Maven 2.0.6; be sure to double-check your version from the commandline after following the steps below, or things will break.

Step 1: Get the Maven Binary

You can download that here.  No other plugins are required.

Step 2: Unpack it on your system

Mac

Explode the zip on your system to /usr/local

Windows

Extract the downloaded Maven zip file to the root of the C: drive, this will create a maven-2.0.9 folder.

Step 3: Set your environment path

Mac

Add a M2_HOME environment variable to your ~/.bash_profile and point it to your download, e.g.:

export M2_HOME=/usr/local/apache-maven-2.0.9

Add the $M2_HOME/bin directory to your path, before /usr/bin.

Windows

Adjust the System Path Variable, appending a semi-colon and the location of the maven\bin directory as shown in this example as C:\maven-2.0.9\bin

MavenInstallImg_007.jpg

Set a M2_HOME environment variable as well.  If you want to get fancy, you can define that first and substitute %M2_HOME%\bin in the System Path variable.

The location of the Windows appdata folder for Vista users is C:\Users\{user.name}

By default if you run "mvn clean" then it creates the .m2 folder at that location.  For example, C:\Users\rick.palmer\.m2

Step 4:  Test your installation

Mac

notch:~ gw$ mvn --version
Maven version: 2.0.9
Java version: 1.5.0_13

If you want to use Java version 1.6.x, you'll need to set up the JVM links properly on your system.  You'll need to add the following to your environment (e.g. in ~/.bash_profile):

export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"

export PATH="$JAVA_HOME/bin:$PATH"

Then use the attached script setJDK.sh like so to see what's installed on your system:

./setJDK.sh

Current JDK version: 1.5
Installed versions:
1.3             1.4             1.4.2           1.5.0           1.6.0           Current
1.3.1           1.4.1           1.5             1.6             A               CurrentJDK

Then you can use the script to actually set the JDK you want:

./setJDK.sh 1.6
Current JDK version: 1.5
You must now enter your Mac OS X password to change the JDK.
Password:
CurrentJDK -> 1.6

Windows

Open a new command window (the changes to the Path variable will not take effect in command windows opened previously) just as you had done to verify the correct operation of the Java Development Kit in the previous step. At the command prompt type:

mvn –version

You should see the response as indicated:

MavenInstallImg_008.jpg

Step 5: Configure your Repository Settings

Create a file called settings.xml in your Maven home directory.

OS

Location

OSX

~/.m2

Windows

%APPDATA%\..\.m2 (running mvn clean will create this for you in your Documents and Settings folder, or read this article for Windows installation tips)

Copy the contents of our settings.xml - For Licensed Customers and Partners  to the file and save it.

Customize the properties to suit your environment.  Look for:

        <properties>
            <!-- Defines Tomcat home directory for Cargo -->
            <tomcat.home><![CDATA[/usr/local/apache-tomcat-6.0.14\]\]\></tomcat.home>
            <tomcat6.home><![CDATA[/usr/local/apache-tomcat-6.0.14\]\]\></tomcat6.home>

            <!-- Specifies whether Cargo should stay alive after running integration tests -->
         <cargo.wait>false</cargo.wait>

            <!-- Overrides the value for the <setup> tag in jive_startup.xml -->
         <jive.setup>true</jive.setup>

            <!-- Your SVN credentials>
         <svn.username>yourname</svn.username>
         <svn.password>yourpass</svn.password>
        </properties>

Properties defined in the settings.xml file are global and will apply to all Maven projects. Properties that may vary from project to project, such as <jiveHome> should not be defined here.