ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: Could I bind an antlib to a xmlns via <taskdef>?
Date Mon, 22 May 2006 12:00:04 GMT
Hi Jan,

You are forgetting to bind the xmlns namespace to a URI.


<project xmlns:example="antlib:a.b.c" .../>
    <taskdef resource="a/b/c/antlib.xml"
             uri="antlib:a.b.c"
                    classpath="jars/example.jar"/>
      <example:hello/>

Peter


On 5/22/06, Jan.Materne@rzf.fin-nrw.de <Jan.Materne@rzf.fin-nrw.de> wrote:
>
> I created an antlib for a bundle of tasks/macrodefs. Including via
>     <project xmlns:ccm="antlib:...">
> works, but then
> - I have to add the antlib to the global Ant installation
> (%ANT_HOME%/lib; %USER_HOME%/.ant/lib)
>   which means the build is not reliable after a checkout on a clean
> machine [1] or
> - modify the start command (ant.bat; %ANT_OPTS%;
> %USER_HOME%/ant_{pre|post}.bat) which makes
>   that machine different from the other in the team.
>
> I would prefer having the antlib in the project directory and bind the
> antlib with the given
> classpath inside the buildfile.
>
>
>
>
>   <typedef resource="antlib:..." uri="ccm"
> classpath="../../build/antlib.jar"/>
>   <ccm:start user="${user}" pwd="${pwd}" database="${db}"/>
> this results in
>   The prefix "ccm" for element "ccm:start" is not bound.
>     at
> org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:233
> )
>     at
> org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:140
> )
>     at
> org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:9
> 1)
>     at org.apache.tools.ant.Main.runBuild(Main.java:653)
>     --- Nested Exception ---
>     at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unkno
> wn Source)
>     ...
>     at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>         at
> org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:217
> )
>
>
>
> I think this is because the error occurs while parsing and the <taskdef>
> would be executed after that.
>
> Does anyone see a possibility to load the antlib from inside the
> buildfile?
>
>
> Jan
>
>
> [1]
> http://martinfowler.com/articles/continuousIntegration.html#MaintainASin
> gleSourceRepository.
>     "The basic rule of thumb is that you should be able to walk up to
> the project with a virgin machine,
>     do a checkout, and be able to fully build the system."
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message