Building from Source

These instructions describe how to build a JAMWiki WAR file directly from the Subversion source repository. Building JAMWiki requires Maven 2.x to build. The Subversion repository is accessible at http://jamwiki.svn.sourceforge.net/svnroot/jamwiki/ and can also be browsed online.

[Edit]Building from source (command line)

[Edit]Prerequisites

Before attempting the build from Source be sure that the following are all available:

  • JDK 1.4 or higher
  • Maven 2 - Needed to build the source and create a WAR file.
  • Subversion - Needed to download the latest source code.

[Edit]Getting the Source

The JAMWiki source is available from the Subversion source repository on Sourceforge.net. To check out the code, first install Subversion and either checkout the trunk branch using a graphical Subversion client (such as TortoiseSVN) or directly from the command line using the command:

svn co http://jamwiki.svn.sourceforge.net/svnroot/jamwiki/wiki/trunk jamwiki

This command will copy the current development code (the "trunk") into a local directory named jamwiki.

[Edit]Building from Source

Building requires Maven. From the top of the source directory (the jamwiki directory in the example above) run the following command:

mvn package

Maven will download all dependencies, compile all files, and build a WAR file named jamwiki-war/target/jamwiki-x.x.x.war. Consult your web application server's documentation for instructions on how to install this file.

[Edit]Install Bliki

If Bliki is missing you can get it from jamwiki/repository/. For install to your local maven repository go to jamwiki/repository/bliki/bliki/3.0-SNAPSHOT and run the following command:

mvn install:install-file -DgroupId=bliki -DartifactId=bliki -Dversion=3.0-SNAPSHOT -Dpackaging=jar -Dfile=bliki-3.0-SNAPSHOT.jar

[Edit]Additional options

To build all project reports the full project must first be built, then the sub-project libraries must be installed into the local repository. From the top of the source directory (the jamwiki directory in the example above) run the following commands:

mvn package
cd javadiff
mvn install
cd ../jamwiki-core
mvn install
cd ../jamwiki-web
mvn install
cd ..

Full site reports can now be run from the top of the source directory (the jamwiki directory in the example above) using the command:

mvn site

To remove all Maven artifacts, leaving only source files, run the command:

mvn clean

To skip JUnit tests when running any Maven command add the property -Dmaven.test.skip. For example:

mvn -Dmaven.test.skip package

To enable Maven debugging you can use Maven and its Jetty plugin. More information about that on Debugging with the Maven Jetty Plugin inside Eclipse

For further Information about Maven see Tech:Maven.

[Edit]Working in your favorite IDE

Please help keep these build instructions up-to-date by updating the steps below with any additional details or corrections.

[Edit]Getting started with Eclipse (first approach)

I've copied my setup for Eclipse to this page: Building from source/Eclipse. Maybe someone else find it useful. --Axel Kramer 08-Jul-2008 10:21 PDT

[Edit]Prerequisite

[Edit]Setup

Install Subclipse and the Maven Eclipse plugins. See the URLs above for full instructions.

  1. In Eclipse go to Help → Software Updates → Find and Install.
  2. Choose "Search for new features to install"
  3. The required plugin URLs are:

Once installed, select the "SVN Repository" Eclipse perspective and add https://jamwiki.svn.sourceforge.net/svnroot/jamwiki/ as a repository. You should now be able to right click on this repository and select the "Check out as a Maven project" option.

[Edit]Usage

In the package explorer view do a right mouse click on the pom.xml file and select the menu Run As -> Maven build....
In the appearing dialog box select the Select... button in the Main tab and choose the package goal:

I needed to run this twice and increase the default java heap for eclipse to -Xmx1024m, because in the first run I get an OutOfMemoryError exception:

[INFO] Compiling 2 source files to C:\IDE\workspace\jamwiki_svn\javadiff\target\classes
org.apache.maven.plugin.CompilationFailureException: Compilation failure
Failure executing javac, but could not parse the error:

The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
	at java.util.zip.ZipEntry.initFields(Native Method)
	at java.util.zip.ZipEntry.<init>(ZipEntry.java:96)
	at java.util.zip.ZipFile$2.nextElement(ZipFile.java:329)
	at java.util.zip.ZipFile$2.nextElement(ZipFile.java:299)
	at com.sun.tools.javac.util.DefaultFileManager$ZipArchive.<init>(DefaultFileManager.java:405)
	at com.sun.tools.javac.util.DefaultFileManager$SymbolArchive.<init>(DefaultFileManager.java:460)
	at com.sun.tools.javac.util.DefaultFileManager.openArchive(DefaultFileManager.java:544)
...

...

[Edit]Getting started with anything Netbeans

mevenide is a plugin for Netbeans which integrates project management possibilities into Netbeans.

[Edit]General information

[Edit]Source Repository Layout

As of JAMWiki 0.6.4 the source code repository is organized as follows:


jamwiki
 |-pom.xml // main Maven project description file
 |-jamwiki-core // core packages including the parser
 |  |-src
 |  |  |-main
 |  |  |   |-java //java source code
 |  |  |   |-jflex // jflex lexer files used for generating parser code
 |  |  |-site
 |  |  |-test 
 |  |  |   |-java // test cases
 |  |  |   |-resources // test properties files and data files
 |-jamwiki-web // servlets and other non-core packages
 |  |-src
 |  |  |-main
 |  |  |   |-java //java source code
 |  |  |-site
 |  |  |-test 
 |  |  |   |-java //test cases
 |-jamwiki-war // JSP files and other code needed for the final WAR package
 |  |-src
 |  |  |-main
 |  |  |   |-resources // properties files and values needed in WEB-INF/classes
 |  |  |   |-webapp // root of war file
 |  |  |        |-WEB-INF
 |  |  |             |-jsp
 |-javadiff // project for org.incava.util.diff package
 |  |-src
 |    |-main
 |         |-java // java source code for org.incava.util.diff package
 |-repository //repository for libraries not available somewhere else.