Laszlo Ant Deployment

Hi,

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" />
<property
name="laszlo.home" value="C:\OpenLaszlo3.3.3\Server\lps-3.3.3"/>
<property
name="laszlo.src.dir" value="${basedir}/lzx"/>

<property
name="laszlo.debug" value="false"/>
<property
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"/>
</path>

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





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