jMatter Build Instructions from SVN Source

Author: pyramid

Date: 2006-12-02

Web: http://crpcapacity.sourceforge.net/

License: GNU GPL v2 (hhttp://www.gnu.org/licenses/gpl.html)

Table of Contents

SVN Source	1

Local SVN Setup	1

SVN Updates	1

Prerequisites	1

Building	2

Testing	2

Example: Creating a new dependent project	2

Upgrading your dependent project from version 20060825	3

Appendix: Build Commands	4

Appendix: Problems and resolutions	5

resource: com/u2d/element/ProgrammingElement.hbm.xml not found	5

symbol : method setDefaultSearchField(com.u2d.element.Field)	5

java.awt.AWTError: Toolkit not found: sun.awt.motif.MToolkit	5

Export XML: Unable to access binding information	6

java.lang.NoClassDefFoundError	6

SVN Source

Local SVN Setup

> mkdir jmatter

> svn checkout http://svn.jmatter.org/jmatter-complet/trunk/ jmatter

SVN Updates

SVN update script:

#!/bin/sh

echo --- UPDATING jMatter ----

svn up jmatter

echo --- UPDATING COMPLETE ----

Finishes with the message

Updated to revision 171.

Prerequisites

None except the ones mentioned in jMatter documentation.

Building

Change to svn directory and run ant

> cd jmatter-svn/jmatter

jmatter-svn/jmatter> ant compile

You will see the building sequence status messages:

Buildfile: build.xml

init: …

gen: …

compile: …

BUILD SUCCESSFUL

Total time: 4 seconds

Now jar the final product:

jmatter-svn/jmatter> ant jar

Buildfile: build.xml

init: …

gen: …

compile: …

bind:

jar:

[jar] Building jar: /home/userdata/PetersArt/CRP/jmatter-svn/jmatter/dist/jmatter.jar

BUILD SUCCESSFUL

Total time: 4 seconds

You should find jmatter.jar with over 1MB file size in the dist folder:

jmatter-svn/jmatter> ls -al dist

-rw-r--r-- 1 pyramid users 1267582 2006-11-15 20:54 jmatter.jar

Testing

One of the new features of the new-project-ui option is:

[a] the ability to specify the base directory for the new project (this is optional; it defaults to a sibling directory fo the jmatter dir).

[b] the ability to create either of two kinds of projects: a standalone or dependent project.

Standalone projects are ones where the framework code is jar'ed and placed in the lib/src folder along with all other dependencies.

Dependent projects are ones whose build files reference jmatter's base directory and targets. this is useful when wanting any framework changes to automatically be visible by the dependent project, without having to re-jar and copy files over.

Example: Creating a new dependent project

Create a new project using the ui functionality. Enter the project name, choose „Dependent“, and then „Create Project“.

jmatter-svn/jmatter> ant new-project-ui

Change to new project dir and run

jmatter-svn/jmatter> cd ../newproject

jmatter-svn/newproject>

Edit the resoures/hibernate.properties file accordingly

and run ant

jmatter-svn/newproject> ant schema-export

jmatter-svn/newproject> ant

Upgrading your dependent project from version 20060825

Create a new dependent project.

Edit the resoures/hibernate.properties file accordingly and run ant

Copy your resources to new project

Copy your doc folder to new project

Copy your sources to new project

Add you classes to class-list.xml

Add you classes to persistClasses.xml

Edit your applicationContext.xml

run ant schema-export and ant

Appendix: Build Commands

Get available commands with ant -projecthelp:

Buildfile: build.xml

Main targets:

bind run JiBX binding compiler

compile compile code

compile-tests compile tests

genhbm generate hbm.xml files

hbm-practice run hbm practice tool

jar jar it

jws-dist create java webstart distribution

run run app

run-a-test run a test

run-test run a test class

run-tests run tests

schema-export export schema to db

schema-update update db schema

shellscript produce runnable shell script

test-report produce junit reports

Default target: run

Appendix: Problems and resolutions

resource: com/u2d/element/ProgrammingElement.hbm.xml not found

In build.xml add:

<mkdir dir="${build.classes.dir}/com/u2d/element" />

Under the target:

<target name="genhbm" depends="bind" description="generate hbm.xml files">

…

</target>

symbol : method setDefaultSearchField(com.u2d.element.Field)

Error:

compile:

[javac] Compiling 12 source files to /home/userdata/PetersArt/CRP/crp-dev/build/classes

[javac] /home/userdata/PetersArt/CRP/crp-dev/src/com/u2d/crp/AvailabilityMfg.java:73: cannot find symbol

[javac] symbol : method setDefaultSearchField(com.u2d.element.Field)

[javac] location: class com.u2d.model.ComplexType

[javac] type.setDefaultSearchField(type.field(""));

[javac] ^

[javac] 1 error

Resolution:

Remove the following lines from the class code:

static

{

ComplexType type = ComplexType.forClass(AvailabilityMfg.class);

type.setDefaultSearchField(type.field(""));

}

java.awt.AWTError: Toolkit not found: sun.awt.motif.MToolkit

The following can be observed on my W2K environment, but not in linux:

[java] Exception in thread "main" org.springframework.beans.factory.BeanCre

ationException: Error creating bean with name 'persistor' defined in class path

resource [persistorContext.xml]: Invocation of init method failed; nested except

ion is java.awt.AWTError: Toolkit not found: sun.awt.motif.MToolkit

[java] Caused by: java.awt.AWTError: Toolkit not found: sun.awt.motif.MTool

kit

[java] at java.awt.Toolkit$2.run(Toolkit.java:828)

[java] at java.security.AccessController.doPrivileged(Native Method)

[java] at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804)

…

Actually I have no idea why the default toolkit was not found on my machine, though the method exists in the jdk. Anyway, this can be avoided by uncommenting the following line from build.xml:

<target name="run" description="run app" depends="genhbm">

...

<jvmarg value="-Dawt.toolkit=sun.awt.motif.MToolkit" />

...

</target>

It is not clear to me why this line has come into the build.xml, since it seems to have no advertent effect on the application run.

Export XML: Unable to access binding information

The following message when exporting an object to XML file:

Unable to access binding information for class com.u2d.crp.Resource

Make sure the binding has been compiled

java.lang.NoSuchFieldException: JiBX_bindingList

java.lang.NoClassDefFoundError

When starting the dist jar file the following error occurs:

pyramid> java -jar crp-dev.jar

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext