You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Cory Riddell <cg...@gmail.com> on 2006/07/04 23:59:22 UTC

Trying to override old definition of task emptymacro

I have two ant files.

base.xml:
  <project name="base" basedir=".">
      <macrodef name="emptymacro">
          <sequential>
              <echo>In base emptymacro</echo>
          </sequential>
      </macrodef>
      <target name="go">
          <emptymacro/>
      </target>
  </project>

deriv.xml:
  <project name="deriv" basedir=".">
      <import file="base.xml"/>
      <macrodef name="emptymacro">
          <sequential>
          </sequential>
      </macrodef>
  </project>

When I do ant -f deriv.xml go I get this output:
  Buildfile: deriv.xml
  Trying to override old definition of task emptymacro

  go:

  BUILD SUCCESSFUL
  Total time: 0 seconds

So, since it reports success, I'm guessing the "Trying to override..."
message is just a warning. I actually am trying to override that
macro. Is that a bad idea? Is there a better way to do this?

I'm using Ant 1.6.5.

-cr

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


Re: Trying to override old definition of task emptymacro

Posted by Dominique Devienne <dd...@gmail.com>.
I don't think macros were 'designed' to be overrideable, and the
message you're seing may not be specific to macros, but applies to
tasks in general (a macro defines a task on the fly kinda). The fact
that the override is still done may be yet another quirk of Ant kept
for backward compatibility reasons.

But you can define your macros in targets, and override one or more of
those targets. Targets were designed to be overriden when <import> was
introduced, and you'll get rid of the message that way.

Personnaly, I'm not fond of the idea of altering the behavior of a
task/macro, unless the 'contract' of the task/macro is somehow not
changed, which seems contradictary... --DD

On 7/5/06, Cory Riddell <cg...@gmail.com> wrote:
> Our builds for release are slightly different than our internal
> development builds (like we sign jars on internal builds with a dummy
> test certificate vs our real certificate on shipping builds). There
> are only a few places that are different and those differences are
> isolated to an ant file that has overrides for a few key tasks.
>
> It seems like a sensible thing to me and I don't understand if there
> is actually a problem or not with what I am doing. Is the "Trying to
> override old definition of task emptymacro" message a warning? Is it
> not doing what I think it will do? The verbage "trying to override"
> makes me think that something is wrong. Why isn't the message If the
> message was less passive ("Overriding old definition of emptymacro" or
> "Failure to override old definition of emptymacro") I wouldn't be
> asking the question.
>
> I did search for this message but never found anything that made me
> comfortable just ignoring it. If you (or anybody) can shed some light,
> I'd appreciate it.
>
> Cory
>
> On 7/5/06, Scot P. Floess <fl...@mindspring.com> wrote:
> > Cory:
> >
> > Just curious, but why do you want to override your macrodef?
> >
> > Scot
> >
> > Cory Riddell wrote:
> > > I have two ant files.
> > >
> > > base.xml:
> > >  <project name="base" basedir=".">
> > >      <macrodef name="emptymacro">
> > >          <sequential>
> > >              <echo>In base emptymacro</echo>
> > >          </sequential>
> > >      </macrodef>
> > >      <target name="go">
> > >          <emptymacro/>
> > >      </target>
> > >  </project>
> > >
> > > deriv.xml:
> > >  <project name="deriv" basedir=".">
> > >      <import file="base.xml"/>
> > >      <macrodef name="emptymacro">
> > >          <sequential>
> > >          </sequential>
> > >      </macrodef>
> > >  </project>
> > >
> > > When I do ant -f deriv.xml go I get this output:
> > >  Buildfile: deriv.xml
> > >  Trying to override old definition of task emptymacro
> > >
> > >  go:
> > >
> > >  BUILD SUCCESSFUL
> > >  Total time: 0 seconds
> > >
> > > So, since it reports success, I'm guessing the "Trying to override..."
> > > message is just a warning. I actually am trying to override that
> > > macro. Is that a bad idea? Is there a better way to do this?
> > >
> > > I'm using Ant 1.6.5.
> > >
> > > -cr
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > >
> >
> > --
> > Scot P. Floess
> > 27 Lake Royale
> > Louisburg, NC  27549
> >
> > 252-478-8087 (Home)
> > 919-754-4592 (Work)
> >
> > Chief Architect JPlate  http://sourceforge.net/projects/jplate
> > Chief Architect JavaPIM http://sourceforge.net/projects/javapim
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Re: Trying to override old definition of task emptymacro

Posted by "Scot P. Floess" <fl...@mindspring.com>.
Well I don't believe its actually overriding the macro def...  You get 
the same kind of warning if you attempt to reassign a property...

I mean, you could hand in data to your macrodef that denotes the type of 
work you want to perform...  I'd have to give it more thought, but I 
don't think based upon what you've described - that overriding the 
macrodef is the right thing to do

Cory Riddell wrote:
> Our builds for release are slightly different than our internal
> development builds (like we sign jars on internal builds with a dummy
> test certificate vs our real certificate on shipping builds). There
> are only a few places that are different and those differences are
> isolated to an ant file that has overrides for a few key tasks.
>
> It seems like a sensible thing to me and I don't understand if there
> is actually a problem or not with what I am doing. Is the "Trying to
> override old definition of task emptymacro" message a warning? Is it
> not doing what I think it will do? The verbage "trying to override"
> makes me think that something is wrong. Why isn't the message If the
> message was less passive ("Overriding old definition of emptymacro" or
> "Failure to override old definition of emptymacro") I wouldn't be
> asking the question.
>
> I did search for this message but never found anything that made me
> comfortable just ignoring it. If you (or anybody) can shed some light,
> I'd appreciate it.
>
> Cory
>
> On 7/5/06, Scot P. Floess <fl...@mindspring.com> wrote:
>> Cory:
>>
>> Just curious, but why do you want to override your macrodef?
>>
>> Scot
>>
>> Cory Riddell wrote:
>> > I have two ant files.
>> >
>> > base.xml:
>> >  <project name="base" basedir=".">
>> >      <macrodef name="emptymacro">
>> >          <sequential>
>> >              <echo>In base emptymacro</echo>
>> >          </sequential>
>> >      </macrodef>
>> >      <target name="go">
>> >          <emptymacro/>
>> >      </target>
>> >  </project>
>> >
>> > deriv.xml:
>> >  <project name="deriv" basedir=".">
>> >      <import file="base.xml"/>
>> >      <macrodef name="emptymacro">
>> >          <sequential>
>> >          </sequential>
>> >      </macrodef>
>> >  </project>
>> >
>> > When I do ant -f deriv.xml go I get this output:
>> >  Buildfile: deriv.xml
>> >  Trying to override old definition of task emptymacro
>> >
>> >  go:
>> >
>> >  BUILD SUCCESSFUL
>> >  Total time: 0 seconds
>> >
>> > So, since it reports success, I'm guessing the "Trying to override..."
>> > message is just a warning. I actually am trying to override that
>> > macro. Is that a bad idea? Is there a better way to do this?
>> >
>> > I'm using Ant 1.6.5.
>> >
>> > -cr
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> > For additional commands, e-mail: user-help@ant.apache.org
>> >
>> >
>>
>> -- 
>> Scot P. Floess
>> 27 Lake Royale
>> Louisburg, NC  27549
>>
>> 252-478-8087 (Home)
>> 919-754-4592 (Work)
>>
>> Chief Architect JPlate  http://sourceforge.net/projects/jplate
>> Chief Architect JavaPIM http://sourceforge.net/projects/javapim
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


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


Re: Trying to override old definition of task emptymacro

Posted by Cory Riddell <cg...@gmail.com>.
Our builds for release are slightly different than our internal
development builds (like we sign jars on internal builds with a dummy
test certificate vs our real certificate on shipping builds). There
are only a few places that are different and those differences are
isolated to an ant file that has overrides for a few key tasks.

It seems like a sensible thing to me and I don't understand if there
is actually a problem or not with what I am doing. Is the "Trying to
override old definition of task emptymacro" message a warning? Is it
not doing what I think it will do? The verbage "trying to override"
makes me think that something is wrong. Why isn't the message If the
message was less passive ("Overriding old definition of emptymacro" or
"Failure to override old definition of emptymacro") I wouldn't be
asking the question.

I did search for this message but never found anything that made me
comfortable just ignoring it. If you (or anybody) can shed some light,
I'd appreciate it.

Cory

On 7/5/06, Scot P. Floess <fl...@mindspring.com> wrote:
> Cory:
>
> Just curious, but why do you want to override your macrodef?
>
> Scot
>
> Cory Riddell wrote:
> > I have two ant files.
> >
> > base.xml:
> >  <project name="base" basedir=".">
> >      <macrodef name="emptymacro">
> >          <sequential>
> >              <echo>In base emptymacro</echo>
> >          </sequential>
> >      </macrodef>
> >      <target name="go">
> >          <emptymacro/>
> >      </target>
> >  </project>
> >
> > deriv.xml:
> >  <project name="deriv" basedir=".">
> >      <import file="base.xml"/>
> >      <macrodef name="emptymacro">
> >          <sequential>
> >          </sequential>
> >      </macrodef>
> >  </project>
> >
> > When I do ant -f deriv.xml go I get this output:
> >  Buildfile: deriv.xml
> >  Trying to override old definition of task emptymacro
> >
> >  go:
> >
> >  BUILD SUCCESSFUL
> >  Total time: 0 seconds
> >
> > So, since it reports success, I'm guessing the "Trying to override..."
> > message is just a warning. I actually am trying to override that
> > macro. Is that a bad idea? Is there a better way to do this?
> >
> > I'm using Ant 1.6.5.
> >
> > -cr
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>
> --
> Scot P. Floess
> 27 Lake Royale
> Louisburg, NC  27549
>
> 252-478-8087 (Home)
> 919-754-4592 (Work)
>
> Chief Architect JPlate  http://sourceforge.net/projects/jplate
> Chief Architect JavaPIM http://sourceforge.net/projects/javapim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Re: Trying to override old definition of task emptymacro

Posted by "Scot P. Floess" <fl...@mindspring.com>.
Cory:

Just curious, but why do you want to override your macrodef?

Scot

Cory Riddell wrote:
> I have two ant files.
>
> base.xml:
>  <project name="base" basedir=".">
>      <macrodef name="emptymacro">
>          <sequential>
>              <echo>In base emptymacro</echo>
>          </sequential>
>      </macrodef>
>      <target name="go">
>          <emptymacro/>
>      </target>
>  </project>
>
> deriv.xml:
>  <project name="deriv" basedir=".">
>      <import file="base.xml"/>
>      <macrodef name="emptymacro">
>          <sequential>
>          </sequential>
>      </macrodef>
>  </project>
>
> When I do ant -f deriv.xml go I get this output:
>  Buildfile: deriv.xml
>  Trying to override old definition of task emptymacro
>
>  go:
>
>  BUILD SUCCESSFUL
>  Total time: 0 seconds
>
> So, since it reports success, I'm guessing the "Trying to override..."
> message is just a warning. I actually am trying to override that
> macro. Is that a bad idea? Is there a better way to do this?
>
> I'm using Ant 1.6.5.
>
> -cr
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


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