tomdz 2005/01/25 13:12:30
Modified: . build.xml
Log:
Simplified and enhanced environment check for building OJB
Removed the need for j2ee.jar in most cases (the geronimo jars are now used
during compilation whenever possible)
Applied patch from 1.0-stable branch concerning the lock-servlet war
Revision Changes Path
1.162 +109 -81 db-ojb/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/db-ojb/build.xml,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -r1.161 -r1.162
--- build.xml 15 Jan 2005 13:51:32 -0000 1.161
+++ build.xml 25 Jan 2005 21:12:30 -0000 1.162
@@ -69,70 +69,118 @@
<!-- ==================================================================
-->
<!-- I N I T
-->
<!-- ==================================================================
-->
- <target name="init" depends="set-archive-name,set-archive-name-date,
- use-jdk12, use-jdk13,
use-jdk14">
- <available property="junit.present"
classname="junit.framework.TestCase"/>
- <condition property="j2ee.classes">
- <and>
- <available classname="javax.transaction.Transaction"
classpathref="compilation-classpath"/>
- <available classname="javax.servlet.Servlet"
classpathref="compilation-classpath"/>
- <available classname="javax.ejb.SessionBean"
classpathref="compilation-classpath"/>
- </and>
- </condition>
- <condition property="jdo.classes">
- <and>
- <available classname="javax.jdo.PersistenceManager"
classpathref="compilation-classpath"/>
- </and>
- </condition>
- <condition property="jdori.classes">
- <and>
- <available classname="com.sun.jdori.enhancer.Main"
classpathref="compilation-classpath"/>
- <available classname="com.sun.jdori.FieldManager"
classpathref="compilation-classpath"/>
- </and>
- </condition>
+ <target name="init"
+ depends="environment-check,
+ set-archive-name,
+ set-archive-name-date,
+ use-jdk12, use-jdk13, use-jdk14, use-jdk15"/>
+
+ <target name="detect-jdk">
+ <condition property="jdk-12">
+ <equals arg1="${ant.java.version}" arg2="1.2" />
+ </condition>
+ <condition property="jdk-13">
+ <equals arg1="${ant.java.version}" arg2="1.3" />
+ </condition>
+ <condition property="jdk-14">
+ <equals arg1="${ant.java.version}" arg2="1.4" />
+ </condition>
+ <condition property="jdk-15">
+ <equals arg1="${ant.java.version}" arg2="1.5" />
+ </condition>
</target>
- <target name="use-jdk12" if="jdk-12" depends="detect-jdk,
check-jdk12proxy-classes, check-jndi-classes">
+ <target name="environment-check" depends="detect-jdk">
+ <fail message="Please set the ANT_HOME environment variable to
the root of your Ant installation.">
+ <condition>
+ <not>
+ <isset property="env.ANT_HOME"/>
+ </not>
+ </condition>
+ </fail>
+ <fail message="Please set the FORREST_HOME environment variable
to the root of your Forrest installation. If you don't have yet installed
Forrest, you can get it from http://forrest.apache.org.">
+ <condition>
+ <not>
+ <isset property="env.FORREST_HOME"/>
+ </not>
+ </condition>
+ </fail>
+ <fail message="Please make JUnit available in the classpath,
e.g. by copying the junit.jar from OJB's lib subdirectory into the lib
subdirectory of your Ant installation (${env.ANT_HOME}/lib).">
+ <condition>
+ <not>
+ <available classname="junit.framework.TestCase"/>
+ </not>
+ </condition>
+ </fail>
+ <fail message="Please make the Apache XML Commons Resolver
library available in the classpath, e.g. by copying the xml-commons-resolver
jar file from the 'tools/ant/lib' subdirectory of your Forrest installation
(${env.FORREST_HOME}/tools/ant/lib) into the lib subdirectory of your Ant
installation (${env.ANT_HOME}/lib).">
+ <condition>
+ <not>
+ <available
classname="org.apache.xml.resolver.Resolver"/>
+ </not>
+ </condition>
+ </fail>
+ <fail message="Please download the JDO 1.0.1 reference
implementation from http://jcp.org/aboutJava/communityprocess/final/jsr012 and
copy the jdo.jar, jdori.jar and jdori-enhancer.jar into OJB's lib directory.">
+ <condition>
+ <not>
+ <and>
+ <!-- We're checking for a class that is not
available in JDO 1.0.0 -->
+ <available
classname="javax.jdo.JDOObjectNotFoundException"
+
classpathref="compilation-classpath"/>
+ <available
classname="com.sun.jdori.enhancer.Main"
+
classpathref="compilation-classpath"/>
+ <available
classname="com.sun.jdori.FieldManager"
+
classpathref="compilation-classpath"/>
+ </and>
+ </not>
+ </condition>
+ </fail>
+ <fail message="In order to compile OJB with JDK 1.2 you need to
download cglib from http://cglib.sourceforge.net and put the jar into OJB's lib
folder.">
+ <condition>
+ <and>
+ <isset property="jdk-12"/>
+ <not>
+ <available classname="net.sf.cglib.proxy.Proxy"
+
classpathref="compilation-classpath"/>
+ </not>
+ </and>
+ </condition>
+ </fail>
+ <fail message="Please make the JNDI classes (javax.naming.*)
available in your classpath. Download them from
http://java.sun.com/products/jndi/downloads/index.html and copy the jndi.jar
into OJB's lib directory.">
+ <condition>
+ <not>
+ <available classname="javax.naming.InitialContext"
+ classpathref="compilation-classpath"/>
+ </not>
+ </condition>
+ </fail>
+ </target>
+
+ <target name="use-jdk12" if="jdk-12">
<property name="JDK" value="-JDK13"/>
<property name="JDBC" value="-JDBC30"/>
<property name="excludes" value="org/apache/ojb/tools/mapping/**"/>
<echo message="detected JDK 1.2"/>
</target>
- <target name="use-jdk13" if="jdk-13" depends="detect-jdk">
+ <target name="use-jdk13" if="jdk-13">
<property name="JDK" value="+JDK13"/>
<property name="JDBC" value="-JDBC30"/>
<property name="excludes" value=""/>
<echo message="detected JDK 1.3"/>
</target>
- <target name="use-jdk14" if="jdk-14" depends="detect-jdk">
+ <target name="use-jdk14" if="jdk-14">
<property name="JDK" value="+JDK13"/>
<property name="JDBC" value="+JDBC30"/>
<property name="excludes" value=""/>
<echo message="detected JDK 1.4"/>
</target>
- <target name="detect-jdk">
- <condition property="jdk-12">
- <equals arg1="${ant.java.version}" arg2="1.2" />
- </condition>
- <condition property="jdk-13">
- <equals arg1="${ant.java.version}" arg2="1.3" />
- </condition>
- <condition property="jdk-14">
- <equals arg1="${ant.java.version}" arg2="1.4" />
- </condition>
- <condition property="jndi.classes">
- <and>
- <available classname="javax.naming.InitialContext"
classpathref="compilation-classpath"/>
- </and>
- </condition>
- <condition property="jdk12proxy.classes">
- <and>
- <available classname="com.develop.java.lang.reflect.Proxy"
classpathref="compilation-classpath"/>
- </and>
- </condition>
+ <target name="use-jdk15" if="jdk-15">
+ <property name="JDK" value="+JDK13"/>
+ <property name="JDBC" value="+JDBC30"/>
+ <property name="excludes" value=""/>
+ <echo message="detected JDK 1.5"/>
</target>
<target name="set-archive-name-date" if="useDate">
@@ -218,32 +266,9 @@
<!-- ==================================================================
-->
- <!-- auxilliary targets that verify that non-ditributable jars
-->
- <!-- are present on the classpath.
-->
- <!-- ==================================================================
-->
- <target name="check-j2ee-classes" unless="j2ee.classes">
- <fail>j2ee.jar is missing! Please get it from
http://java.sun.com/j2ee/. Put it in lib or have the ant property j2ee.jars
point at this jar file.</fail>
- </target>
- <target name="check-jdo-classes" unless="jdo.classes">
- <fail>jdo.jar is missing! Please get it from
http://java.sun.com/products/jdo. Put it in lib or have the ant property
jdo.jars point at this jar file.</fail>
- </target>
- <target name="check-jdori-classes" unless="jdori.classes">
- <fail>jdori.jar is missing! Please get it from
http://java.sun.com/products/jdo. Put it in lib or have the ant property
jdo.jars point at this jar file.</fail>
- </target>
- <target name="check-jndi-classes" if="jdk-12" unless="jndi.classes">
- <fail>jndi.jar is missing! Please get it from http://java.sun.com/.
Put it in the lib directory.</fail>
- </target>
- <target name="check-jdk12proxy-classes" if="jdk-12"
unless="jdk12proxy.classes">
- <fail>proxy.jar is missing! Please get it from
http://sf.net/projects/objectbridge/. Put it in the lib directory.</fail>
- </target>
-
-
-
-
- <!-- ==================================================================
-->
<!-- Build all the sources with debug and deprecation
-->
<!-- ==================================================================
-->
- <target name="main" depends="prepare, check-j2ee-classes,
check-jdo-classes, preprocess"
+ <target name="main" depends="prepare, preprocess"
description="Compile all Java sources with debugging on.">
<javac srcdir="${build.src}" destdir="${build.dest}"
excludes="${excludes}"
debug="on" debuglevel="source,lines,vars"
deprecation="${deprecation}">
@@ -260,7 +285,7 @@
</target>
<!-- include OJB JDORI implementation -->
- <target name="with-jdori" depends="prepare, check-jdo-classes,
check-jdori-classes"
+ <target name="with-jdori" depends="prepare"
description="Compile OJB JDORI">
<copy todir="${build.src}">
<fileset dir="${src.dir}/jdori"/>
@@ -554,35 +579,38 @@
<!-- ==================================================================
-->
<target name="lockservlet-war" depends="jar, prepare-testdb"
description="Builds The Lockserver servlet for deployment in
tomcat">
+
+ <property name="build.servlet" value="${build.dir}/lock-servlet"/>
+
<delete file="${dist}/ojb-lockserver.war"/>
- <delete dir="${build.dir}/WEB-INF" verbose="false"/>
- <mkdir dir="${build.dir}/WEB-INF/classes"/>
- <mkdir dir="${build.dir}/WEB-INF/lib"/>
+ <delete dir="${build.servlet}/WEB-INF" verbose="false"/>
+ <mkdir dir="${build.servlet}/WEB-INF/classes"/>
+ <mkdir dir="${build.servlet}/WEB-INF/lib"/>
<!-- 1. apache-ojb-xxx.jar -->
- <copy file="${dist}/${archive}.jar"
todir="${build.dir}/WEB-INF/lib"/>
+ <copy file="${dist}/${archive}.jar"
todir="${build.servlet}/WEB-INF/lib"/>
<!-- 2. OJB.properties and repository*.* files -->
- <copy todir="${build.dir}/WEB-INF/classes">
+ <copy todir="${build.servlet}/WEB-INF/classes">
<fileset dir="${build.test}/ojb"
includes="*.properties,*.dtd,*.xml"/>
</copy>
- <copy todir="${build.dir}/WEB-INF">
+ <copy todir="${build.servlet}/WEB-INF">
<fileset dir="${build.srctest}/org/apache/ojb"
includes="web.xml"/>
</copy>
<!-- 3. additional jar files -->
- <copy todir="${build.dir}/WEB-INF/lib">
+ <copy todir="${build.servlet}/WEB-INF/lib">
<fileset dir="${lib}">
- <include name="log4j-1.2.8.jar"/>
- <include name="commons-logging.jar"/>
- <include name="commons-lang-2.0.jar"/>
+ <include name="log4j*.jar"/>
+ <include name="commons-logging*.jar"/>
+ <include name="commons-lang*.jar"/>
</fileset>
</copy>
<!-- 4. the business code, that is our servlet-->
- <copy todir="${build.dir}/WEB-INF/classes">
+ <copy todir="${build.servlet}/WEB-INF/classes">
<fileset dir="${build.dest}"
includes="org/apache/ojb/odmg/locking/**"/>
</copy>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]