ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: Ant 1.5 to 1.7 problem.
Date Mon, 12 Nov 2007 15:46:54 GMT
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} =
&quot;${db.schema.up.to.date}&quot;"/>
        <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} =
&quot;${db.schema.up.to.date}&quot;"/>
        <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 <majorshao@gmail.com> 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 <qazwart@gmail.com> 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 <majorshao@gmail.com> 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: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > >
> >
> >
> > --
> > --
> > David Weintraub
> > qazwart@gmail.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>



-- 
--
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message