How To for Maven#

Introduction#

This page explains how to customize JSPWiki (2.5.x) to manage jar files using Apache Maven 2, and Ant. This allows greater control over the version of third party libraries included into the JSPWiki.war file. You may want to do this if you're integrating JSPWiki with some other project, or if you are adding new functionality to JSPWiki that uses Spring or Hibernate where the versions matter. This page and these changes are geared towards developers, not towards MereMortals.

Assumptions#

We assume you've already installed and are building JSPWiki using Ant. If not, then please consult BuildingJSPWiki. No IDE is used for Maven integration.

Project directories are assumed to be setup at the same level as:

d:/dev/JSPWiki
d:/dev/myProject

We will customize the JSPWiki build from the myProject, not from within JSPWiki. This will allow us to keep JSPWiki updated via CVS, while still building our custom version based on it. We will use Ant for building, not Maven. Maven will only function to allow for third party jar file management for now.

Install Maven#

Download and install Maven as documented at the Apache website. Use Maven version 2.0.4 or higher. Make sure you can:

mvn -version

We also need to install the Maven tasks for Ant. This involves placing the maven-artifact-ant-2.0.4-dep.jar file in $ANT_HOME/lib.

Install Third Party libraries into Maven Repo#

The third party Maven libraries need to be installed into your local Maven repository. The script third-party-local-install.sh(info) shows how this is done for many libraries.

Generally all of the JSPWiki's required libraries are bundled with JSPWiki itself, so you won't need to download and unpack them from their respective websites. However, many of the bundled libraries are using older versions (as of JSPWiki 2.5.22), and you may want to try to the latest.

WARNING: this script is more of a guide. Running it blindly could pollute your local Maven2 repository. Read the documentation included in the file, then change the file to suit your system, and run with it.

Customize the POM#

Get the pom.xml(info), which will be used as a starting point for building a plain vanilla JSPWiki. The pom.xml will need to live in your custom application's base directory. The pom.xml should live here:

d:/dev/myProject/pom.xml

Customize the Ant build file#

Get the build-JSPWiki.xml(info) file. It should live with the same directory as the pom.xml:

d:/dev/myProject/build-JSPWiki.xml
You should search-replace the "myProject" string and replace it with your own value in this file. This file is named "build-JSPWiki.xml" so that you're "myProject" can have it's own build.xml for building local resources for inclusion into the JSPWiki.war file. You might configure build.xml to import build-JSPWiki.xml, or you might just call build-JSPWiki.xml on your own with:
cd d:/dev/myProject
ant -f build-JSPWiki.xml war

Discussion#

The jspwiki-user group has discussed migrating to Maven, but no decision was made to do so. The documentation here is provided as a guide for those that wish to do so anyway. --Jason Thrasher.
I sign here because I plan to update this for JSPWiki 2.8.2 --Baráti,Zoltán

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
xml
build-JSPWiki.xml 3.0 kB 1 26-Feb-2007 21:53 Jason Thrasher added ant file
xml
pom.xml 7.5 kB 1 26-Feb-2007 20:58 Jason Thrasher created Maven2 POM for JSPWiki 2.5.22
sh
third-party-local-install.sh 3.2 kB 1 26-Feb-2007 20:02 JasonThrasher v1 script for installing 3rd party libs into Maven repo
« This page (revision-6) was last changed on 15-Nov-2009 00:46 by Baráti,Zoltán