<!-- | |
Licensed to the Apache Software Foundation (ASF) under one | |
or more contributor license agreements. See the NOTICE file | |
distributed with this work for additional information | |
regarding copyright ownership. The ASF licenses this file | |
to you under the Apache License, Version 2.0 (the | |
"License"); you may not use this file except in compliance | |
with the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, | |
software distributed under the License is distributed on an | |
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
KIND, either express or implied. See the License for the | |
specific language governing permissions and limitations | |
under the License. | |
--> | |
<!-- ====================================================================== --> | |
<!-- Build script to compile, package a OpenJPA/Slice based application --> | |
<!-- with Google Web Toolkit client to be deployed in a servlet container. --> | |
<!-- ====================================================================== --> | |
<project name="OpenTrader"> | |
<!-- local environment paths for required libraries --> | |
<property file="build.properties" /> | |
<!-- root directory for *.java and GWT module descriptor --> | |
<property name="src.dir" value="src/main/java" /> | |
<!-- root directory for web.xml, persistence.xml, cascaded stylesheets --> | |
<!-- images and the entry point html file --> | |
<property name="rsrc.dir" value="src/main/resources" /> | |
<!-- root directory for the deployment layout --> | |
<property name="war.dir" value="war" /> | |
<!-- root directory for compiled *.class files --> | |
<!-- the directory is named according to packaging of web application --> | |
<property name="classes.dir" value="war/WEB-INF/classes" /> | |
<!-- root directory for jar files application depends on --> | |
<!-- the directory is named according to packaging of web application --> | |
<property name="lib.dir" value="war/WEB-INF/lib" /> | |
<!-- the target web archieve created by this script --> | |
<property name="target.war" value="opentrader.war" /> | |
<!-- the name of the GWT module. The module descriptor must be placed --> | |
<!-- relative w.r.t. source root for GWT compiler --> | |
<property name="gwt.module" value="org.apache.openjpa.trader.OpenTrader" /> | |
<!-- relevant GWT class libraries. gwt-user.jar however should not be --> | |
<!-- deployed in a servlet container as this jar contains javax.servlet --> | |
<!-- classes. gwt-servlet is the right jar to deploy --> | |
<!-- cobogw.jar is used for rounded panels. --> | |
<path id="gwt.classpath"> | |
<pathelement location="${gwt.sdk}/gwt-user.jar" /> | |
<pathelement location="${gwt.sdk}/gwt-dev.jar" /> | |
<pathelement location="${gwt.sdk}/gwt-servlet.jar" /> | |
<pathelement location="${gwt.sdk}/cobogw-1.3.1.jar" /> | |
</path> | |
<!-- classpath for normal java compilation --> | |
<path id="java.compile.classpath"> | |
<pathelement path="${openjpa.jar}" /> | |
<path refid="gwt.classpath" /> | |
</path> | |
<!-- classpath for OpenJPA bytecode enhanement requires the resource --> | |
<!-- root directory to locate persitence.xml descriptor --> | |
<path id="openjpa.compile.classpath"> | |
<pathelement path="${openjpa.jar}" /> | |
<pathelement path="${classes.dir}" /> | |
<pathelement path="${rsrc.dir}" /> | |
</path> | |
<!-- classpath for GWT Compiler requires the application source code --> | |
<!-- and standard JPA jar as well, because application domain classes --> | |
<!-- refer them through source code mapping annotations --> | |
<path id="gwt.compile.classpath"> | |
<path refid="gwt.classpath" /> | |
<pathelement path="${src.dir}" /> | |
<pathelement path="${jpa.jar}" /> | |
<pathelement path="${classes.dir}" /> | |
<pathelement path="${rsrc.dir}" /> | |
</path> | |
<target name="clean" description="Deletes all derived resources"> | |
<delete dir="${war.dir}"/> | |
<delete dir="${target.war}" /> | |
</target> | |
<!-- compilation proceeds in 3 phases. Compiling normal Java, bytecode --> | |
<!-- followed by GWT compilation. --> | |
<target name="compile" depends="clean"> | |
<mkdir dir="${classes.dir}" /> | |
<antcall target="compile.pojo"/> | |
<antcall target="compile.gwt"/> | |
<antcall target="compile.openjpa"/> | |
</target> | |
<target name="compile.pojo"> | |
<javac srcdir="src" | |
destdir="${classes.dir}" | |
verbose="false" | |
debug="true"> | |
<classpath refid="java.compile.classpath" /> | |
<exclude name="**/override/**" /> | |
</javac> | |
</target> | |
<target name="compile.gwt"> | |
<java classname="com.google.gwt.dev.Compiler" | |
failonerror="true" | |
fork="true"> | |
<classpath refid="gwt.compile.classpath" /> | |
<arg value="-logLevel" /> | |
<arg value="WARN" /> | |
<arg value="${gwt.module}" /> | |
</java> | |
</target> | |
<target name="compile.openjpa"> | |
<java classname="org.apache.openjpa.enhance.PCEnhancer" | |
failonerror="true" | |
fork="true"> | |
<classpath refid="openjpa.compile.classpath" /> | |
<arg value="-properties" /> | |
<arg value="META-INF/persistence.xml#exchange" /> | |
</java> | |
</target> | |
<!-- packaging for development. Copies relevant files from the source --> | |
<!-- in a layour mimicing the web archive structure for deployment --> | |
<target name="devpack"> | |
<copy file="${src.dir}/org/apache/openjpa/trader/OpenTrader.gwt.xml" | |
tofile="${classes.dir}/org/apache/openjpa/trader/OpenTrader.gwt.xml" /> | |
<copy todir="${war.dir}"> | |
<fileset dir="${rsrc.dir}"> | |
<include name="WEB-INF/web.xml" /> | |
<include name="OpenTrader.html" /> | |
<include name="css/OpenTrader.css" /> | |
</fileset> | |
</copy> | |
<copy todir="${war.dir}"> | |
<fileset dir="${rsrc.dir}"> | |
<include name="help/*.*" /> | |
</fileset> | |
</copy> | |
<copy todir="${classes.dir}"> | |
<fileset dir="${rsrc.dir}"> | |
<include name="images/*.*" /> | |
<include name="META-INF/persistence.xml" /> | |
</fileset> | |
</copy> | |
<copy todir="${lib.dir}" file="${openjpa.jar}" /> | |
<!-- do not deploy gwt-user.jar as it contains javax.servlet.* --> | |
<copy todir="${lib.dir}" file="${gwt.sdk}/gwt-servlet.jar" /> | |
<copy todir="${lib.dir}" file="${gwt.sdk}/cobogw-1.3.1.jar" /> | |
<copy todir="${lib.dir}" file="${jdbc.jar}" /> | |
</target> | |
<target name="package" | |
depends="devpack" | |
description="Package OpenTrader as a WAR archieve"> | |
<delete file="${target.war}" /> | |
<jar destfile="${target.war}" | |
filesonly="true" | |
duplicate="fail" update="true" | |
basedir="${war.dir}"> | |
</jar> | |
</target> | |
<!-- classpath for running the aplication in development mode. --> | |
<path id="dev.run.classpath"> | |
<path refid="gwt.classpath" /> | |
<pathelement path="${src.dir}" /> | |
<pathelement path="${war.dir}" /> | |
<pathelement path="${war.dir}/WEB-INF/classes" /> | |
<pathelement path="${openjpa.jar}" /> | |
<pathelement path="${jdbc.jar}" /> | |
</path> | |
<target name="devmode" depends="devpack" description="Runs in development mode"> | |
<java failonerror="true" | |
fork="true" | |
classname="com.google.gwt.dev.DevMode"> | |
<classpath refid="dev.run.classpath" /> | |
<jvmarg value="-Xmx256M" /> | |
<arg value="-startupUrl" /> | |
<arg value="OpenTrader.html" /> | |
<arg value="-logLevel" /> | |
<arg value="DEBUG" /> | |
<arg value="${gwt.module}" /> | |
</java> | |
</target> | |
<target name="deploy" depends="package"> | |
<copy file="${target.war}" todir="${auto.deploy.dir}" /> | |
</target> | |
</project> |