Here is a sample of a way that we've used in a few customer projects.
Put this sample Ant build file in the top-level directory of your StreamBase project, and customize to your project requirements. It requires only that STREAMBASE_HOME be defined, and that the project has a directory named lib.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="MYPROJECT">
<property environment="env" />
<property name="debuglevel" value="source,lines,vars" />
<property name="target" value="1.7" />
<property name="source" value="1.7" />
<property name="sblib" value="${env.STREAMBASE_HOME}/lib" />
<property name="sbunitlog" value="sbunit-log" />
<path id="MYPROJECT.classpath">
<pathelement location="${sblib}/sbclient.jar" />
<pathelement location="${sblib}/sbserver.jar" />
<pathelement location="${sblib}/sbtest-unit.jar" />
<pathelement location="${sblib}/junit.jar" />
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="java-bin"/>
</path>
<target name="build">
<mkdir dir="java-bin" />
<javac debug="true" debuglevel="${debuglevel}" destdir="java-bin" source="${source}" target="${target}" includeantruntime="false">
<src path="java-src" />
<classpath refid="MYPROJECT.classpath" />
</javac>
</target>
<target name="sbunit" depends="build">
<mkdir dir="${sbunitlog}" />
<junit printsummary="yes" haltonfailure="no" fork="yes">
<classpath refid="MYPROJECT.classpath" />
<sysproperty key="streambase.unit-test.server-conf" value="sbd.sbconf"/>
<jvmarg value="-Xmx2g"/>
<!-- <jvmarg value="-Dstreambase.log-level=2"/ -->
<formatter type="xml" />
<batchtest fork="yes" todir="${sbunitlog}">
<fileset dir="java-src">
<include name="**/test/*.java" />
<include name="**/tests/*.java" />
<include name="**/Test*Test.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${sbunitlog}">
<fileset dir="${sbunitlog}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${sbunitlog}" />
</junitreport>
</target>
<target name="clean">
<delete dir="${sbunitlog}"/>
<delete>
<fileset dir="java-bin" includes="**"/>
</delete>
</target>
</project>
There is an example StreamBase project
here that uses the example 18939977_build.xml file above. It's in a public Subversion repository and can be imported into to StreamBase Studio using this read-only repository URL:
http://svn.code.sf.net/p/streambase-ant-example/code/ via File > Import... > SVN > Project from SVN > Next > URL