Skip to content

Instantly share code, notes, and snippets.

@ubermichael
Last active May 13, 2022 16:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ubermichael/beff98fc0b939788c908ac75b149d35c to your computer and use it in GitHub Desktop.
Save ubermichael/beff98fc0b939788c908ac75b149d35c to your computer and use it in GitHub Desktop.
Example of an ant build.xml file for uploading files to eXistDb with credentials stored in a properties file
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="wilde" xmlns:xdb="http://exist-db.org/ant">
<description>Wilde Trials International News Archive</description>
<property name="host" value="localhost"/>
<property file="${host}.properties"/>
<path id="classpath.core">
<fileset dir="${local.dir}/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${local.dir}/exist.jar"/>
<pathelement path="${local.dir}/exist-optional.jar"/>
</path>
<typedef resource="org/exist/ant/antlib.xml" uri="http://exist-db.org/ant">
<classpath refid="classpath.core"/>
</typedef>
<target name="fetch">
<echo>Fetching data from ${host} at ${server.data}</echo>
<xdb:extract uri="${server.data}" destdir="data"
user="${server.user}" password="${server.pass}"
subcollections="true" createdirectories="true" overwrite="true"/>
</target>
<target name="store-reports">
<echo>Storing reports to ${host} at ${server.data}</echo>
<xdb:store uri="${server.data}/reports" createcollection="true"
user="${server.user}" password="${server.pass}"
createsubcollections="true" type="xml">
<fileset dir="./data/reports">
<include name="**/*.xml"/>
</fileset>
</xdb:store>
</target>
</project>
local.dir=/Applications/eXist-db
server.host=localhost
server.port=8080
server.path=exist/xmlrpc/db/apps/wilde-data
server.root=xmldb:exist://${server.host}:${server.port}/${server.path}
server.data=${server.root}/data
server.user=admin
server.pass=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment