ant typedef trouble (and documentation typo)

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

ant typedef trouble (and documentation typo)

Jakob Fix-2
Hello,

I'm rather Java-ignorant, so please forgive me the following ...

http://exist-db.org/ant-tasks.html gives only the following
information as to how ant should be configured:

<taskdef resource="org/exist/ant/antlib.xml">
<classpath refid="classpath.core"/>
</typedef>

Apparently, there's a problem with the documentation, my guess is the
opening GI should be <typedef ...> also.

Now, I have put the exist-optional.jar in the current directory,
because looking inside I found the antlib.xml and the different tasks.
 But this, and using
<typedef resource="org/exist/ant/antlib.xml" classpath="."/>

returns this error message
[typedef] Could not load definitions from resource
org/exist/ant/antlib.xml. It could not be found.

I tried several other variations of the "file", "resource" and
"classname" attributes which all didn't change a thing.

Any help is appreciated.

--
cheers,
Jakob.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: ant typedef trouble (and documentation typo)

Wolfgang Meier-2
Hi Jakob,

I'm using the following setup in my build files:

    <path id="classpath.core">
        <fileset dir="WEB-INF/lib">
            <include name="*.jar"/>
        </fileset>
    </path>

    <typedef resource="org/exist/ant/antlib.xml"
        uri="http://exist-db.org/ant">
        <classpath refid="classpath.core"/>
    </typedef>

Wolfgang


> Hello,
>
> I'm rather Java-ignorant, so please forgive me the following ...
>
> http://exist-db.org/ant-tasks.html gives only the following
> information as to how ant should be configured:
>
> <taskdef resource="org/exist/ant/antlib.xml">
> <classpath refid="classpath.core"/>
> </typedef>
>
> Apparently, there's a problem with the documentation, my guess is the
> opening GI should be <typedef ...> also.
>
> Now, I have put the exist-optional.jar in the current directory,
> because looking inside I found the antlib.xml and the different tasks.
>  But this, and using
> <typedef resource="org/exist/ant/antlib.xml" classpath="."/>
>
> returns this error message
> [typedef] Could not load definitions from resource
> org/exist/ant/antlib.xml. It could not be found.
>
> I tried several other variations of the "file", "resource" and
> "classname" attributes which all didn't change a thing.
>
> Any help is appreciated.
>
> --
> cheers,
> Jakob.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: ant typedef trouble (and documentation typo)

Jakob Fix-2
Hi Wolfgang,

thanks for this information.  I spent some time trying why it still
doesn't work, and am still stuck.  But first, some findings:

In order to be able to use these ant tasks, a namespace has to be
declared on the project element, like this:

<project
  name="testproject"
  xmlns:xdb="http://exist-db.org/ant">

This must be the same namespace uri as the one used on the typedef element

<typedef resource="org/exist/ant/antlib.xml" uri="http://exist-db.org/ant">

The example given in the Ant User Manual
(http://ant.apache.org/manual/CoreTypes/antlib.html) is quite
confusing.

Once this is done, the tasks supplied by exist can be called like this:

<xdb:[taskname] ...>

I am trying to connect to a local, embedded database, and it appears,
for this to work, one has to use a uri as shown:

<xdb:store uri="xmldb:exist:///db/test1/test2/test3"
  user="admin"
  password=""
  createcollection="true">

I say "it appears", because ant still bombs

Buildfile: D:\dy\tests\ExistAntTask\build.xml
add-document:

BUILD FAILED
D:\dy\tests\ExistAntTask\build.xml:17: XMLDB exception caught: local
database server not running

Total time: 1 second


Why is this?

Would it be possible to add these tidbits, assuming of course they are
correct? I wouldn't mind doing this if told how.

--
cheers,
Jakob.

On 13/10/05, Wolfgang Meier <[hidden email]> wrote:

> Hi Jakob,
>
> I'm using the following setup in my build files:
>
>     <path id="classpath.core">
>         <fileset dir="WEB-INF/lib">
>             <include name="*.jar"/>
>         </fileset>
>     </path>
>
>     <typedef resource="org/exist/ant/antlib.xml"
>         uri="http://exist-db.org/ant">
>         <classpath refid="classpath.core"/>
>     </typedef>
>


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: ant typedef trouble (and documentation typo)

Jakob Fix-2
adding to my previous post:
the minimal required jar files seem to be:
commons-pool-1.1.jar
exist.jar
exist-optional.jar
log4j-1.2.9.jar
xmldb.jar
xmlrpc-1.2-patched.jar

At least, I don't get errors regarding missing jar files any more.
Still, the task doesn't complete successfully (again, see my previous
mail).

Thanks,


On 14/10/05, Jakob Fix <[hidden email]> wrote:

> Hi Wolfgang,
>
> thanks for this information.  I spent some time trying why it still
> doesn't work, and am still stuck.  But first, some findings:
>
> In order to be able to use these ant tasks, a namespace has to be
> declared on the project element, like this:
>
> <project
>   name="testproject"
>   xmlns:xdb="http://exist-db.org/ant">
>
> This must be the same namespace uri as the one used on the typedef element
>
> <typedef resource="org/exist/ant/antlib.xml" uri="http://exist-db.org/ant">
>
> The example given in the Ant User Manual
> (http://ant.apache.org/manual/CoreTypes/antlib.html) is quite
> confusing.
>
> Once this is done, the tasks supplied by exist can be called like this:
>
> <xdb:[taskname] ...>
>
> I am trying to connect to a local, embedded database, and it appears,
> for this to work, one has to use a uri as shown:
>
> <xdb:store uri="xmldb:exist:///db/test1/test2/test3"
>   user="admin"
>   password=""
>   createcollection="true">
>
> I say "it appears", because ant still bombs
>
> Buildfile: D:\dy\tests\ExistAntTask\build.xml
> add-document:
>
> BUILD FAILED
> D:\dy\tests\ExistAntTask\build.xml:17: XMLDB exception caught: local
> database server not running
>
> Total time: 1 second
>
>
> Why is this?
>
> Would it be possible to add these tidbits, assuming of course they are
> correct? I wouldn't mind doing this if told how.
>
> --
> cheers,
> Jakob.
>
> On 13/10/05, Wolfgang Meier <[hidden email]> wrote:
> > Hi Jakob,
> >
> > I'm using the following setup in my build files:
> >
> >     <path id="classpath.core">
> >         <fileset dir="WEB-INF/lib">
> >             <include name="*.jar"/>
> >         </fileset>
> >     </path>
> >
> >     <typedef resource="org/exist/ant/antlib.xml"
> >         uri="http://exist-db.org/ant">
> >         <classpath refid="classpath.core"/>
> >     </typedef>
> >
>


--
cheers,
Jakob.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: ant typedef trouble (and documentation typo)

Mark Harrah-4
In reply to this post by Jakob Fix-2
Hi Jakob,

> <xdb:store uri="xmldb:exist:///db/test1/test2/test3"
>   user="admin"
>   password=""
>   createcollection="true">

For local databases, you have to add the attribute initdb="true" to xdb:store.  
If you look at the beginning of the ant tasks documentation, there is a part
describing attributes common to all tasks, including the initdb attribute.

I think you only need to use this attribute on the first ant task that
operates on the embedded database.  Then, when you are finished, you will
probably want to use the shutdown ant task.

Hope that helps,
Mark


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: ant typedef trouble (and documentation typo)

Jakob Fix-2
Hi Mark,

On 14/10/05, Mark Harrah <[hidden email]> wrote:

> Hi Jakob,
>
> > <xdb:store uri="xmldb:exist:///db/test1/test2/test3"
> >   user="admin"
> >   password=""
> >   createcollection="true">
>
> For local databases, you have to add the attribute initdb="true" to xdb:store.
> If you look at the beginning of the ant tasks documentation, there is a part
> describing attributes common to all tasks, including the initdb attribute.

You're right, that helped (a bit :-)), thanks.  It's moving forward,
little by little.  Now, I am running ant from both inside Eclipse and
from the command line.  Eclipse uses ant 1.6.5, and throws the
following errors/warnings:

[xdb:store] configuring exist using C:\eclipse/conf.xml
[xdb:store] log4j:WARN No appenders could be found for logger
(org.exist.util.Configuration).
[xdb:store] log4j:WARN Please initialize the log4j system properly.

BUILD FAILED
D:\dy\tests\ExistAntTask\build.xml:15: XMLDB exception caught:
configuration error

Why is exist looking inside the eclipse directory for its conf.xml
file, and how can I tell it to look else where?


The command line version (1.6.1) has the following errors:

BUILD FAILED
D:\dy\tests\ExistAntTask\build.xml:15: The
<http://exist-db.org/ant:store> type doesn't support the nested
"fileset" element.

Oioioi! Well, I will update the command line version to the latest
version, and will try again, although I find this bizarre.

Thanks again!
--
cheers,
Jakob.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: ant typedef trouble (and documentation typo)

Mark Harrah-4
Hi Jakob,

> Why is exist looking inside the eclipse directory for its conf.xml
> file, and how can I tell it to look else where?

I use the config="<path-to-config>" attribute, which I noticed is not
documented.

> BUILD FAILED
> D:\dy\tests\ExistAntTask\build.xml:15: The
> <http://exist-db.org/ant:store> type doesn't support the nested
> "fileset" element.

This is probably because you have <fileset ...> elements (like the
documentation does) instead of <xdb:fileset ...> elements.

-Mark


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: ant typedef trouble (and documentation typo)

Jakob Fix-2
Mark,

On 14/10/05, Mark Harrah <[hidden email]> wrote:
> Hi Jakob,
>
> > Why is exist looking inside the eclipse directory for its conf.xml
> > file, and how can I tell it to look else where?
>
> I use the config="<path-to-config>" attribute, which I noticed is not
> documented.

ah. Mmh, on this subject the commandline and Eclipse ants agree with
the documentation:

BUILD FAILED
D:\dy\tests\ExistAntTask\build.xml:17: The
<http://exist-db.org/ant:store> type doesn't support the "config"
attribute.

Obviously, I put the attribute inside the store element.  But trying
it on the typedef (you see, I am getting desperate) made Eclipse go
all yellow and the little warning sign in the margin showed up ... :-)


> > BUILD FAILED
> > D:\dy\tests\ExistAntTask\build.xml:15: The
> > <http://exist-db.org/ant:store> type doesn't support the nested
> > "fileset" element.
>
> This is probably because you have <fileset ...> elements (like the
> documentation does) instead of <xdb:fileset ...> elements.

I'm not there yet ... but thanks.

> -Mark

--
cheers,
Jakob.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: ant typedef trouble (and documentation typo)

wolfgangmm
Hi Jakob,

I attach one of my own build.xml files, which works for me inside as
well as outside eclipse. Maybe it helps.

Wolfgang

build.xml (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: ant typedef trouble (and documentation typo)

Mark Harrah-4
In reply to this post by Jakob Fix-2
Hi Jakob,

> ah. Mmh, on this subject the commandline and Eclipse ants agree with
> the documentation:
>
> BUILD FAILED
> D:\dy\tests\ExistAntTask\build.xml:17: The
> <http://exist-db.org/ant:store> type doesn't support the "config"
> attribute.

My apologies!  It appears I added this option when I came across the same
problem and never remembered to contribute it.  No wonder it isn't
documented.  So, here is a small patch that provides a config attribute to
all ant tasks, if you need it to solve your problem.

-Mark

AbstractXMLDBTask.patch (1K) Download Attachment