Skip to content

How to successfully edit QTIEngine

Sat 26th October 2013

A couple of days ago I posted how to get QTIEngine to run in Grails 2.1.1, even though it was written for 1.2.1. A few other incompatibilities made me revert to the closest version of Grails I could find: 1.2.5. Whatever it was that wasn’t working seemed to have resolved itself!

However, all of this was done in the vain effort to try and fix QTIEngine’s rendering of <pre> tags, so obviously I had to work out how to edit the code and successfully recompile it all into a state where it will all run again. For anyone who might want to do this in the future, here is what I learned.

Compiling

QTIEngine is built on top of a number of subpackages which are in the same source tree. The one I needed to edit was JQTI-Rendering. During my debugging, to find where the whitespace was being stripped out of the <pre> tags, I made some changes to the file /JQTI-Rendering/src/main/java/org/qtitools/qti/rendering/Renderer.java and recompiled using mvn package install (as the qtitools wiki says to).

What I later discovered is that this recompiles the appropriate files, puts them in a JAR and then puts them in the local Maven repository (~/.m2/repository). Sensible step you might think: then other things on your system can use it from this repository.

Grails cache

Of course, Grails is here to mess everything up. Obviously Grails has it’s own cache, that it doesn’t seem to document in any shape or form, and there’s only one not-properly-answered question on StackOverflow about. Obviously it moves the filesystem location of this directory between versions, so if you’ve compiled for Grails 2.1.1 and Grails 1.2.5 you have two of them. Obviously it never clears this cache. In fact, obviously it has no way to clear this cache.

This is why even though I was changing the code, nothing was changing in the final executed version: Grails was still looking at a JAR for JQTI-Rendering that had been compiled 3 days ago when I first downloaded the source.

The two places I’ve found Grails might store this cache (which is actually an Ant Ivy cache) are:

  • ~/.ivy2/cache (Grails ~1.2.5)
  • ~/.grails/ivy-cache (Grails ~2.1.1)

Not sure what they did in between, or when it changed over.

To clear it, simply rm the file you want to refresh, or more drastically rm -rf ~/.ivy/cache/*

Put Simply

To edit a file in one of the supporting JQTI libraries:

  1. Edit file
  2. mvn package install
  3. rm -rf ~/.ivy2/cache/org.qtitools/* ~/.ivy2/cache/org.qtitools.qti/*
  4. grails run-app in QTIEngine folder
Leave a Comment

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.