Laszlo Ant Deployment


The Laszlo compiler itself is a servlet, that internally
calls a org.openlaszlo.compiler.Main to compile the application into a
SWF file. You could also use the lzc.bat in the bin directory to get
compiled applications. Well, there sure are numerous documents for
deploying Laszlo applications either as standalone application, or as
proxy applications, but like most build writers, I would really want
some quick ANT code snippet that I can copy paste in my build script.

So here is a quick script that you can put into your ant file to get Laszlo compiled with the other build stuff.
<property name="out.dir" value = "${basedir}\html\swf" />
name="laszlo.home" value="C:\OpenLaszlo3.3.3\Server\lps-3.3.3"/>
name="laszlo.src.dir" value="${basedir}/lzx"/>

name="laszlo.debug" value="false"/>
name="laszlo.proxied" value = "false"/>

<path id = "laszlo.lib">
    <pathelement location="${laszlo.home}/WEB-INF/lps/server/build" />
    <pathelement location="${laszlo.home}/WEB-INF/classes" />
    <fileset dir = "${laszlo.home}/3rd-party/jars/dev" includes="**/*.jar"/>
    <fileset dir = "${laszlo.home}/WEB-INF/lib" includes="**/*.jar"/>

<target name = "compile.laszlo">
    <mkdir dir= "${out.dir}" />
    <java classname = "org.openlaszlo.compiler.Main" fork = "true"
        dir = "${laszlo.src.dir}"
        <jvmarg value = "-DLPS_HOME=${laszlo.home}"/>
value = "-Dlzdebug=${laszlo.debug}"/>
value = "-Dlzproxied=${laszlo.proxied}"/>
value = "-Xms1024M"/>
value = "-Xmx1024M"/>
        <arg line="--dir ${out.dir} --runtime=swf7 --mcache on --onerror warn main.lzx" />

  • laszlo.home : Path of the Laszlo Server, till the lps-*.*.* directory
  • main.lzx : The main entry point where the canvas is placed
  • out.dir : The directory where the main.swf is to be placed
  • laszlo.src.dir : Place where main.lzx is placed
  • laszlo.lib.dir : The classpath reference to all the jar files
  • laszlo.debug : same as canvas.debug.
  • laszlo.proxied : same as canvas.proxied. false if you want a standalone swf on tomcat.
Once the standalone SWF is created, you can deploy it on tomcat (if compiled in SOLO / NON-Proxied mode).