Java Client build sript

14 views
Skip to first unread message

tomasvdb

unread,
Aug 27, 2005, 12:47:40 PM8/27/05
to AdWords API Forum
for those of you using a java client to use the adwords API and have
problems keeping your client up to date as the API changes, here's a
ant build script that will build a jar based on the latest wsdl files.
Obviously you can change the script to suit your needs is necessary.


<?xml version="1.0" encoding="UTF-8"?>

<!-- ============================================================= -->
<!-- View the readme.txt file for build instructions -->
<!-- ============================================================= -->

<project basedir="." default="all" name="adwordswsclient">

<property name="version" value="2.0.0"/>
<property name="src.java" value="${basedir}/src/java"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="main.class" value="undefined"/>
<property name="dist.javadoc.dir" value="${basedir}/dist/javadoc"/>

<property name="service.url.prefix"
value="https://adwords.google.com/api/adwords/v2"/>
<property name="service.package" value="com.google.adwords.api"/>

<!-- Classpath -->
<path id="project.class.path">
<pathelement path="lib/axis-1.2.1.jar"/>
<pathelement path="lib/axis-ant-1.2.1.jar"/>
<pathelement path="lib/commons-discovery-0.2.jar"/>
<pathelement path="lib/commons-logging-1.0.4.jar"/>
<pathelement path="lib/jaxrpc.jar"/>
<pathelement path="lib/saaj.jar"/>
<pathelement path="lib/wsdl4j-1.5.1.jar"/>
<pathelement path="lib/javamail-1.3.2.jar"/>
<pathelement path="lib/activation.jar"/>
<pathelement path="lib/junit-3.8.1.jar"/>
</path>

<taskdef resource="axis-tasks.properties"
classpathref="project.class.path" />

<!-- ======================================================= -->
<!-- Initialization target -->
<!-- ======================================================= -->

<target name="init">
<tstamp/>
</target>

<!-- ======================================================= -->
<!-- Target clean -->

<!-- ======================================================= -->

<target name="clean">
<delete dir="${build.dir}"/>
</target>

<!-- ======================================================= -->
<!-- Compile utility classes -->
<!-- ======================================================= -->

<target name="compile" depends="init">
<delete dir="${build.dir}/classes"/>
<mkdir dir="${build.dir}/classes"/>

<axis-wsdl2java url="${service.url.prefix}/CampaignService?wsdl"
verbose="true" output="${src.java}">
<mapping namespace="${service.url.prefix}"
package="${service.package}" />
</axis-wsdl2java>

<axis-wsdl2java url="${service.url.prefix}/AdGroupService?wsdl"
verbose="true" output="${src.java}">
<mapping namespace="${service.url.prefix}"
package="${service.package}" />
</axis-wsdl2java>

<axis-wsdl2java url="${service.url.prefix}/KeywordService?wsdl"
verbose="true" output="${src.java}">
<mapping namespace="${service.url.prefix}"
package="${service.package}" />
</axis-wsdl2java>

<axis-wsdl2java url="${service.url.prefix}/CreativeService?wsdl"
verbose="true" output="${src.java}">
<mapping namespace="${service.url.prefix}"
package="${service.package}" />
</axis-wsdl2java>

<axis-wsdl2java url="${service.url.prefix}/InfoService?wsdl"
verbose="true" output="${src.java}">
<mapping namespace="${service.url.prefix}"
package="${service.package}" />
</axis-wsdl2java>

<axis-wsdl2java url="${service.url.prefix}/AccountService?wsdl"
verbose="true" output="${src.java}">
<mapping namespace="${service.url.prefix}"
package="${service.package}" />
</axis-wsdl2java>

<axis-wsdl2java
url="${service.url.prefix}/TrafficEstimatorService?wsdl" verbose="true"
output="${src.java}">
<mapping namespace="${service.url.prefix}"
package="${service.package}" />
</axis-wsdl2java>

<axis-wsdl2java url="${service.url.prefix}/ReportService?wsdl"
verbose="true" output="${src.java}">
<mapping namespace="${service.url.prefix}"
package="${service.package}" />
</axis-wsdl2java>

<javac debug="true"
deprecation="true"
srcdir="${src.java}"
destdir="${build.dir}/classes">

<!-- <compilerarg line="-Xlint:unchecked"/> -->
<classpath refid="project.class.path"/>
<include name="**/*.java"/>
</javac>
</target>

<!-- ======================================================= -->
<!-- Target build -->
<!-- ======================================================= -->

<target name="build" depends="clean, compile">
<jar jarfile="${build.dir}/${ant.project.name}-${version}.jar"
whenempty="skip"
basedir="${build.dir}/classes"
includes="**"
/>

<copy file="${build.dir}/${ant.project.name}-${version}.jar"
todir="../adwordswsclient/lib" />

</target>

<!-- ======================================================= -->
<!-- Target run -->
<!-- ======================================================= -->
<target name="run" depends="build">
<java classname="${main.class}"
fork="true"
failonerror="true">

<classpath refid="project.class.path"/>
</java>
</target>

<target name="all" depends="build" />
</project>

Reply all
Reply to author
Forward
0 new messages