Skip to content

Instantly share code, notes, and snippets.

@awrowse
Created June 21, 2012 19:12
Show Gist options
  • Save awrowse/2967889 to your computer and use it in GitHub Desktop.
Save awrowse/2967889 to your computer and use it in GitHub Desktop.
Java CWS ANT File
<?xml version="1.0" encoding="UTF-8"?>
<project default="all" name="DemoApp">
<property name="lib.dir" value="${basedir}/lib"/>
<property name="build.src.dir" location="${basedir}/src"/>
<property name="build.dir" location="${basedir}/bin"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="build.classes.dir" location="${build.dir}/classes"/>
<property name="main-class" value="com.rightnow.ps.example.DemoApp"/>
<property file="${basedir}/antbuild.properties"/>
<path id="axis2.classpath" description="Axis 2 library">
<fileset dir="${axis2.home}/lib">
<include name="**/*.jar"/>
<include name="*.jar"/>
</fileset>
</path>
<path id="wss4j.classpath" description="WSS4J library">
<fileset dir="${wss4j.home}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="all">
<antcall target="clean"/>
<antcall target="cleanWSDLBindings"/>
<antcall target="axis2WSDLToJava"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="compile">
<mkdir dir="${build.classes.dir}"/>
<javac srcdir="${build.src.dir}" destdir="${build.classes.dir}" includeantruntime="false">
<classpath refid="axis2.classpath"/>
<classpath refid="wss4j.classpath"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<manifestclasspath property="lib.list" jarfile="${jar.dir}/${ant.project.name}.jar">
<classpath refid="wss4j.classpath"/>
<classpath refid="axis2.classpath"/>
</manifestclasspath>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${build.classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
<attribute name="Class-Path" value="${lib.list}"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java jar="${jar.dir}/${ant.project.name}.jar" fork="true">
</java>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
<target name="cleanWSDLBindings">
<delete dir="src/com/rightnow/ws/"/>
</target>
<target name="axis2WSDLToJava">
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
<classpath refid="axis2.classpath"/>
<arg value="-uri"/>
<arg value="${wsdl.home}"/>
<arg value="-ns2p"/>
<arg value="urn:wsdl.ws.rightnow.com/v1=com.rightnow.ws.wsdl,urn:objects.ws.rightnow.com/v1=com.rightnow.ws.objects,urn:messages.ws.rightnow.com/v1=com.rightnow.ws.messages,urn:common.ws.rightnow.com/v1=com.rightnow.ws.common"/>
<arg value="-o"/>
<arg file="${basedir}"/>
<arg value="--noBuildXML"/>
<arg value="-Ejavaversion"/>
<arg value="1.6"/>
<arg value="-u"/>
<arg value="-uw"/>
<arg value="-or"/>
</java>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment