But what the...., OpenLaszlo is distributed as a war package (yes, there is a binary installer, but that is just a tomcat with the war deployed in it). Hmm, ... I use maven for building, so I tried to find the dependencies in the maven repository. No luck there.
I ended up pulling apart the warfile, finding the stuff I needed and producing a pom from that. Here are some of the problems I encountered:
- OpenLaszlo seems to use some dependencies that most other Java applications does not (at least not the ones I build or use). For instance, it is long time since I worked with saxon, and what is "jing" from "thaiopensource"? :-)
- Many of the dependencies in WEB-INF/lib inside the warfile had no versioning information, neither in the filename nor in the manifest
- The saxon parser in WEB-INF/lib was a modified one, where the "META-INF/services" part of the jarfile, that sets it up as the default SAXParser, had been taken out. In the pom I produced, I first took the liberty to use a saxon from the maven repository, but this made spring and tapestry from the technology stack of my application fail (the SAXParser in saxon failed to support validation and schemas)
- The jdom.jar in WEB-INF/lib was something like a 1.0.1, but the latest release from jdom.org is 1.0. Hmm, strange, but the one in the distribution includes a fix for xml comments, which is needed to make things work
- Upload it in a maven repository you control (path: org/openlaszlo/openlaszlo/4.0.0/openlaszlo-4.0.0.pom)
- Download the OpenLaszlo 4.0.0 distribution
- Upload the 5 jars from WEB-INF/lib (jdom, saxon, swflib, jing, lps) and name them properly to enable the pom to find them (org/openlaszlo/openlaszlo-jdom/4.0.0/openlaszlo-jdom-4.0.0.jar, org/openlaszlo/openlaszlo-lps/4.0.0/openlaszlo-lps-4.0.0.jar, org/openlaszlo/openlaszlo-saxon/4.0.0/openlaszlo-saxon-4.0.0.jar, org/openlaszlo/openlaszlo-swflib/4.0.0/openlaszlo-swflib-4.0.0.jar, org/openlaszlo/openlaszlo-thaiopensource-jing/4.0.0/openlaszlo-thaiopensource-jing-4.0.0.jar)
- In the pom of your warfile project that is to use OpenLaszlo, include a dependency on the new pom (see below)
- Include "other stuff you need" from the warfile (see below)
Are we there yet?
No, we are not. Because OpenLaszlo includes a lot of stuff in the webapp in "lps/" and in "WEB-INF/lps" that is needed to make anything work. In addition to this, you will need some files from "WEB-INF/classes". I did this by depending on the OpenLaszlo warfile in the pom of my application and then specify exactly which parts to include as a war overlay. Like this:
<plugin>Of course, you will need to upload the warfile in your repository too. It should be placed and named like this: "org/openlaszlo/openlaszlo/4.0.0/openlaszlo-4.0.0.war".
But why not use war overlays to simply include all from WEB-INF/lib and then avoid all the above stuff about the new pom and uploading jars in a repository you control. Well, you can. But you will end up with a lot of uncontrolled jar dependencies without version information, inside your distribution unit. Not nice.
And then what?
You should then go on and define the OpenLaszlo servlets (see the web.xml of the warfile distribution) and read the documentation.
BTW: I've uploaded the pom to an existing issue in the OpenLaszlo bugtracking tool. Would be nice if they would distribute to the global maven repository when releasing....