David Thanks a lot for this. I tried it. It was good first time. When i ran it again, it gave the same error. (i changed a little on the echo msg)
Sorry if it is late to mention here, we use a customized runant.py to run the build.xml; it does have some cutomized things inside to load different properties we need for different modules in the whole build. Here is the output of the 1st run (added the -debug option) Using Ant patch ant151patch.jar -Djvm=jrockit1.4.2_05 -Dant.home.dir=T:/Eng/win32bin/apache-ant-1.7.0 java version "1.4.2_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.0-1 (build ari-38120-20041118-1131-win-ia32, Native Threads, GC strategy: pa rallel) Apache Ant version 1.7.0 compiled on December 13 2006 Buildfile: build.xml Adding reference: ant.PropertyHelper Detected Java version: 1.4 in: T:\eng\win32bin\weblogic8.1.4\jrockit81sp4_142_05\jre Detected OS: Windows XP Adding reference: ant.ComponentHelper Setting ro project property: ant.file -> T:\eng\ccroot\build.xml Adding reference: ant.projectHelper Adding reference: ant.parsing.context Adding reference: ant.targets parsing buildfile T:\eng\ccroot\build.xml with URI = file:/T:/eng/ccroot/build.xml Setting ro project property: ant.project.name -> test Adding reference: test Setting ro project property: ant.file.test -> T:\eng\ccroot\build.xml Project base dir set to: T:\eng\ccroot +Target: +Target: check.db.schema.up.to.date +Target: test1 +Target: test2 +Target: test [antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found. Setting project property: get.dbversion.build.dir -> build Setting project property: db.root.dir -> src [mkdir] Created dir: T:\eng\ccroot\build\src [mkdir] Created dir: T:\eng\ccroot\src Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor Adding reference: ant.executor Build sequence for target(s) `test' is [check.db.schema.up.to.date, test1, test2, test] Complete build sequence is [check.db.schema.up.to.date, test1, test2, test, ] check.db.schema.up.to.date: [uptodate] The targetfile "T:\eng\ccroot\build\src\dbinfo.properties" does not exist. test1: Skipped because property 'db.schema.up.to.date' not set. test2: Property "db.schema.up.to.date" has not been set [echo] check this out::${db.schema.up.to.date} [echo] Need to rebuild [touch] Creating T:\eng\ccroot\build\src\dbinfo.properties test: BUILD SUCCESSFUL Total time: 0 seconds [wfm]T:\eng\ccroot> Here is the output of 2nd run (i added the -debug option) Using Ant patch ant151patch.jar -Djvm=jrockit1.4.2_05 -Dant.home.dir=T:/Eng/win32bin/apache-ant-1.7.0 java version "1.4.2_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.0-1 (build ari-38120-20041118-1131-win-ia32, Native Threads, GC strategy: pa rallel) Apache Ant version 1.7.0 compiled on December 13 2006 Buildfile: build.xml Adding reference: ant.PropertyHelper Detected Java version: 1.4 in: T:\eng\win32bin\weblogic8.1.4\jrockit81sp4_142_05\jre Detected OS: Windows XP Adding reference: ant.ComponentHelper Setting ro project property: ant.file -> T:\eng\ccroot\build.xml Adding reference: ant.projectHelper Adding reference: ant.parsing.context Adding reference: ant.targets parsing buildfile T:\eng\ccroot\build.xml with URI = file:/T:/eng/ccroot/build.xml Setting ro project property: ant.project.name -> test Adding reference: test Setting ro project property: ant.file.test -> T:\eng\ccroot\build.xml Project base dir set to: T:\eng\ccroot +Target: +Target: check.db.schema.up.to.date +Target: test1 +Target: test2 +Target: test [antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found. Setting project property: get.dbversion.build.dir -> build Setting project property: db.root.dir -> src [mkdir] Skipping T:\eng\ccroot\build\src because it already exists. [mkdir] Skipping T:\eng\ccroot\src because it already exists. Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor Adding reference: ant.executor Build sequence for target(s) `test' is [check.db.schema.up.to.date, test1, test2, test] Complete build sequence is [check.db.schema.up.to.date, test1, test2, test, ] check.db.schema.up.to.date: BUILD FAILED T:\eng\ccroot\build.xml:11: java.lang.ExceptionInInitializerError at org.apache.tools.ant.dispatch.DispatchUtils.execute(Ljava.lang.Object;)V(DispatchUtils.java:115) at org.apache.tools.ant.Task.perform()V(Task.java:348) at org.apache.tools.ant.Target.execute()V(Target.java:357) at org.apache.tools.ant.Target.performTasks()V(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Ljava.util.Vector;)V(Project.java:1329) at org.apache.tools.ant.Project.executeTarget(Ljava.lang.String;)V(Project.java:1298) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(Lorg.apache.tools.ant.Project;[Ljava.lang.String;) V(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Ljava.util.Vector;)V(Project.java:1181) at org.apache.tools.ant.Main.runBuild(Ljava.lang.ClassLoader;)V(Main.java:698) at org.apache.tools.ant.Main.startAnt([Ljava.lang.String;Ljava.util.Properties;Ljava.lang.ClassLoader;)V(Main.ja va:199) at org.apache.tools.ant.Main.start([Ljava.lang.String;Ljava.util.Properties;Ljava.lang.ClassLoader;)V(Main.java: 161) at org.apache.tools.ant.Main.main([Ljava.lang.String;)V(Main.java:250) Caused by: java.lang.ExceptionInInitializerError at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(Lorg.apache.tools.ant.Project;)Lorg.apache.too ls.ant.DirectoryScanner;(AbstractFileSet.java:429) at org.apache.tools.ant.taskdefs.UpToDate.eval()Z(UpToDate.java:206) at org.apache.tools.ant.taskdefs.UpToDate.execute()V(UpToDate.java:232) at org.apache.tools.ant.UnknownElement.execute()V(UnknownElement.java:288) at jrockit.reflect.NativeMethodInvoker.invoke0(Ljava.lang.Object;ILjava.lang.Object;[Ljava.lang.Object;)Ljava.la ng.Object;(Unknown Source) at jrockit.reflect.NativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown S ource) at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Un known Source) at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source) at org.apache.tools.ant.dispatch.DispatchUtils.execute(Ljava.lang.Object;)V(DispatchUtils.java:105) ... 11 more Caused by: Don't know how to detect os family "openvms" at org.apache.tools.ant.taskdefs.condition.Os.isOs(Ljava.lang.String;Ljava.lang.String;Ljava.lang.String;Ljava.l ang.String;)Z(Os.java:230) at org.apache.tools.ant.taskdefs.condition.Os.isFamily(Ljava.lang.String;)Z(Os.java:150) at org.apache.tools.ant.DirectoryScanner.<clinit>()V(DirectoryScanner.java:128) at jrockit.vm.RNI.initializeClassFromJava(II)V(Unknown Source) at jrockit.vm.RNI.clinitTrampoline()V(Unknown Source) ... 20 more --- Nested Exception --- java.lang.ExceptionInInitializerError at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(Lorg.apache.tools.ant.Project;)Lorg.apache.too ls.ant.DirectoryScanner;(AbstractFileSet.java:429) at org.apache.tools.ant.taskdefs.UpToDate.eval()Z(UpToDate.java:206) at org.apache.tools.ant.taskdefs.UpToDate.execute()V(UpToDate.java:232) at org.apache.tools.ant.UnknownElement.execute()V(UnknownElement.java:288) at jrockit.reflect.NativeMethodInvoker.invoke0(Ljava.lang.Object;ILjava.lang.Object;[Ljava.lang.Object;)Ljava.la ng.Object;(Unknown Source) at jrockit.reflect.NativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown S ource) at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Un known Source) at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source) at org.apache.tools.ant.dispatch.DispatchUtils.execute(Ljava.lang.Object;)V(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform()V(Task.java:348) at org.apache.tools.ant.Target.execute()V(Target.java:357) at org.apache.tools.ant.Target.performTasks()V(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Ljava.util.Vector;)V(Project.java:1329) at org.apache.tools.ant.Project.executeTarget(Ljava.lang.String;)V(Project.java:1298) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(Lorg.apache.tools.ant.Project;[Ljava.lang.String;) V(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Ljava.util.Vector;)V(Project.java:1181) at org.apache.tools.ant.Main.runBuild(Ljava.lang.ClassLoader;)V(Main.java:698) at org.apache.tools.ant.Main.startAnt([Ljava.lang.String;Ljava.util.Properties;Ljava.lang.ClassLoader;)V(Main.ja va:199) at org.apache.tools.ant.Main.start([Ljava.lang.String;Ljava.util.Properties;Ljava.lang.ClassLoader;)V(Main.java: 161) at org.apache.tools.ant.Main.main([Ljava.lang.String;)V(Main.java:250) Caused by: Don't know how to detect os family "openvms" at org.apache.tools.ant.taskdefs.condition.Os.isOs(Ljava.lang.String;Ljava.lang.String;Ljava.lang.String;Ljava.l ang.String;)Z(Os.java:230) at org.apache.tools.ant.taskdefs.condition.Os.isFamily(Ljava.lang.String;)Z(Os.java:150) at org.apache.tools.ant.DirectoryScanner.<clinit>()V(DirectoryScanner.java:128) at jrockit.vm.RNI.initializeClassFromJava(II)V(Unknown Source) at jrockit.vm.RNI.clinitTrampoline()V(Unknown Source) ... 20 more Total time: 0 seconds David Weintraub wrote: > > I just wrote the following test build.xml: > > <project name="test" default="test" basedir="."> > > <property name="get.dbversion.build.dir" value="build"/> > <property name="db.root.dir" value="src"/> > > <mkdir dir="${get.dbversion.build.dir}/src"/> > <mkdir dir="${db.root.dir}"/> > > <target name="check.db.schema.up.to.date" > > <uptodate property="db.schema.up.to.date" > targetfile="${get.dbversion.build.dir}/src/dbinfo.properties" > > > <srcfiles dir= "${db.root.dir}" > > <include name="DBInfo.java" /> > <include name="GetDbInfo.java" /> > </srcfiles> > </uptodate> > </target> > > <target name="test1" > depends="check.db.schema.up.to.date" > if="db.schema.up.to.date"> > > <echo message="$${db.schema.up.to.date} = > "${db.schema.up.to.date}""/> > <echo message="No need for a build"/> > <touch file="${db.root.dir}/DBInfo.java"/> > <touch file="${db.root.dir}/GetDbInfo.java"/> > </target> > > <target name="test2" > depends="check.db.schema.up.to.date" > unless="db.schema.up.to.date"> > > <echo message="$${db.schema.up.to.date} = > "${db.schema.up.to.date}""/> > <echo message="Need to rebuild"/> > <touch file="${get.dbversion.build.dir}/src/dbinfo.properties"/> > </target> > > <target name="test" > depends="test1,test2"/> > </project> > > As you can see, my "check.db.schema.up.to.date" target is the same > code that you gave in your example, and I had no problems with this > particular build file with the outofdate task. > > Why not test this build.xml file and see if it works for you? All you > have to do is put it into a test directory, and run "ant" on it. It > will automatically create the needed files and directories. Each time > you run this build.xml, it will alternate between saying that the > project is out of date and isn't out of date. > > If this build.xml file doesn't work for you, then is probably an issue > with your installation of either Java or Ant. > > On Nov 9, 2007 4:12 PM, Major shao <[EMAIL PROTECTED]> wrote: >> java version "1.4.2_05" >> >> Thanks for reply, I really need help on this! >> >> I suspect it's caused by the ant 1.7 does not take the dir path property >> ${ >> get.dbversion.build.dir} in the uptodate task. But it still failed if i >> replace it with absolute path. >> I do not understand. The forward slash or backward slash should not >> matter, >> right? >> >> And, this target is in an embedded xml. That means, the target is called >> from the build.xml (using &build_config;) which has the >> build_config.xml >> (which has this uptodate target). >> >> When I echo the property inside this target right before the task >> uptodate, >> it shows correct path. But it still fails and complains the uptodate >> task. >> >> >> >> On 11/9/07, David Weintraub <[EMAIL PROTECTED]> wrote: >> > >> > What version of Java are you using? With Ant1.7.0, I think you need >> > Java 1.4 or later. >> > >> > On 11/9/07, Major shao <[EMAIL PROTECTED]> wrote: >> > > Hi, everyone >> > > >> > > i am trying to upgrade the project from ant1.5.1 to ant1.7.0 >> > > >> > > it gave error build_config.xml:151: >> > java.lang.ExceptionInInitializerError >> > > >> > > the line 151 of that xml is a uptodate task. Any idea why i got the >> > > error? Please kindly help. >> > > Your reply is highly appreciated. >> > > >> > > <target name="check.db.schema.up.to.date" > >> > > <uptodate property="db.schema.up.to.date" >> > > targetfile="${get.dbversion.build.dir}/src/dbinfo.properties" > >> > > <srcfiles dir= "${db.root.dir}" > >> > > <include name="DBInfo.java" /> >> > > <include name="GetDbInfo.java" /> >> > > </srcfiles> >> > > </uptodate> >> > > </target> >> > > >> > > >> > > I tried to not to use the ${get.dbversion.build.dir}, it still does >> not >> > > work. Though it works if i use >> > > <uptodate property="db.schema.up.to.date" srcfile="test1.java" >> > > targetfile="dbinfo.properties" > >> > > i cannot find out why. >> > > And, it looks like i have more similar issues in the other following >> > > lines in the xml. I cannot just change everything to not having the >> > > path variable. Please help! >> > > >> > > Thanks >> > > >> > > Richard >> > > >> > > --------------------------------------------------------------------- >> > > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > > For additional commands, e-mail: [EMAIL PROTECTED] >> > > >> > > >> > >> > >> > -- >> > -- >> > David Weintraub >> > [EMAIL PROTECTED] >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > > > > -- > -- > David Weintraub > [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Ant-1.5-to-1.7-problem.-tf4776225.html#a13713015 Sent from the Ant - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]