Current development on JAMWiki is primarily focused on maintenance rather than new features due to a lack of developer availability. If you are interested in working on JAMWiki please join the jamwiki-devel mailing list.

Building from source/Eclipse

Contents

Prerequisite[edit]

Setup[edit]

Install Subclipse, the Maven Eclipse and the Tomcat Launcher plugins.

  1. In Eclipse go to Help → Software Updates → Find and Install.
  2. Choose "Search for new features to install"
  3. The required plugin URLs for subclipse and M2Eclipse are:
  4. For the Tomcat Launcher see the above URL for full install instructions.

PLEASE NOTE: I experienced many issues installing all of these plugins on a fresh install of Ubuntu 12.04. I don't know if it was somehow my personal configuration or if there is some issue. I was eventually able to overcome by fully closing Eclipse, restarting, and trying everything again. Once I did this I experienced no issues installing the plugins mentioned above.

Once installed, select the "SVN Repository" Eclipse perspective and add

as a repository URL.
You should now be able to click on this repository and open the SVN tree:

m2eclipselaumch003.png

Right click on the trunk node, select the "Find/Check out as..." menu option. In the following dialog box you can Check out the source code:

m2eclipselaunch002.png

Maven package build[edit]

Now change back to the Java perspective.

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:

m2eclipselaunch001.png

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)
...

...

Configure the JAMWiki Eclipse project[edit]

The Maven package build has now generated some additional files and directories.

Copy these generated jflex files:

  • JAMWikiPostProcessor.java
  • JAMWikiPreProcessor.java
  • JAMWikiProcessor.java
  • JAMWikiSpliceProcessor.java

from

C:\IDE\workspace\jamwiki_svn\jamwiki-core\target\generated-sources\jflex\org\jamwiki\parser\jflex

to

C:\IDE\workspace\jamwiki_svn\jamwiki-core\src\main\java\org\jamwiki\parser\jflex

Delete these files from the

C:\IDE\workspace\jamwiki_svn\jamwiki-war\target\jamwiki-war-0.6.6-SNAPSHOT\WEB-INF\lib 

directory:

  • jamwiki-core-0.6.6-SNAPSHOT.jar
  • jamwiki-web-0.6.6-SNAPSHOT.jar
  • bliki-1.0-SNAPSHOT.jar or bliki-3.0-SNAPSHOT.jar

and delete this file

C:\IDE\workspace\jamwiki_svn\jamwiki-war\target\jamwiki-war-0.6.6-SNAPSHOT.war

Select the Eclipse Window → Preferences... menu. In the dialog select the node Java → Build Path → Classpath Variables and:

  1. define an Eclipse "Classpath Variable" called JAMWIKI_WEBAPP which points to
    C:/IDE/workspace/jamwiki_svn/jamwiki-war/target/jamwiki-war-0.6.6-SNAPSHOT
  2. define an Eclipse "Classpath Variable" called TOMCAT_HOME which points to your Tomcat home directory. In my case it points to:
    C:/server/tomcat-6.0.13

After that, select the Tomcat node and define your Tomcat settings. Be sure that the directory C:\server\tomcat-6.0.13\conf\Catalina\localhost exists:

m2eclipselaunch005.png

Edit the .project file, so that the project is a Java, Maven2 and Tomcat plugin related project:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>jamwiki_svn</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.maven.ide.eclipse.maven2Builder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.maven.ide.eclipse.maven2Nature</nature>
		<nature>com.sysdeo.eclipse.tomcat.tomcatnature</nature>
	</natures>
</projectDescription>

Create a new source folder named mysrc.

Change the .classpath file in the following way:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="src" path="my-src"/>
	<classpathentry kind="src" path="addon-src"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
	<classpathentry combineaccessrules="false" kind="src" path="/info.bliki.wiki.svn"/>
	<classpathentry kind="lib" path="/info.bliki.wiki.svn/lib/core-renderer.jar"/>
	<classpathentry kind="lib" path="/info.bliki.wiki.svn/lib/itext-paulo-155.jar"/>
	<classpathentry kind="lib" path="lib/junit.jar"/>
	<classpathentry kind="lib" path="/info.bliki.wiki.svn/lib/commons-codec-1.3.jar"/>
	<classpathentry kind="lib" path="/info.bliki.wiki.svn/lib/commons-logging.jar"/>
	<classpathentry kind="lib" path="/info.bliki.wiki.svn/lib/commons-validator-1.3.1.jar"/>
	<classpathentry kind="lib" path="/info.bliki.wiki.svn/lib/jakarta-oro.jar"/>
	<classpathentry kind="lib" path="/info.bliki.wiki.svn/lib/commons-fileupload-1.2.jar"/>
	<classpathentry kind="var" path="TOMCAT_HOME/lib/servlet-api.jar"/>
	<classpathentry kind="lib" path="/info.bliki.wiki.svn/lib/commons-httpclient-3.1.jar"/>
	<classpathentry kind="lib" path="lib/mysql-connector-java-3.1.10-bin.jar"/>
	<classpathentry kind="lib" path="/info.bliki.wiki.svn/lib/commons-lang-2.4.jar"/>
	<classpathentry kind="output" path="bin"/>
</classpath>

Do a right mouse click on your project and select menu Properties. In the dialog box select the Tomcat node. In the dialog box define the Application-URI as jam066 and the sub-directory for the webapps root as /jamwiki-war/target/jamwiki-war-0.6.6-SNAPSHOT: m2eclipselaunch004.png

Run JAMWiki[edit]

In the Java perspective's toolbar, where are three buttons to

  • start Tomcat
  • stop Tomcat
  • restart Tomcat

m2eclipselaunch006.png

Press the Start Tomcat button and you should see the Tomcat logging in the Eclipse Console view. (If the Console view isn't open, you can open it in the menu Window → Show View → Console)

Now open a browser and run JAMWiki with the following URL:

JAMWiki should automatically switch to the installation setup page:

Create a directory for your JAMWiki cache, search, database and upload files:

 c:\temp\jamwiki

and configure it in the setup page. I've used the following path settings in the setup process:

...
file-dir-full-path=C\:\\IDE\\workspace\\jamwiki_svn\\jamwiki-war\\target\\jamwiki-war-0.6.6-SNAPSHOT\\upload
file-dir-relative-path=/jam066/upload/
...
homeDir=C\:\\temp\\jamwiki

Stop Tomcat now and do a refresh (right mouse click in the Package Explorer view and select menu Refresh F5) of your JAMWiki Eclipse project.

The JAMWiki installation created a new properties file:

/jamwiki_svn/jamwiki-war/target/jamwiki-war-0.6.6-SNAPSHOT/WEB-INF/classes/jamwiki.properties

Copy this jamwiki.properties file directly under your mysrc folder.

In the jamwiki.properties file you can now directly edit the configuration and restart Tomcat afterwards. For example I configured my Bliki engine as the default Wikipedia syntax parser:

parser=org.jamwiki.parser.bliki.BlikiParser