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, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]