---
title: "Using Ant"
source: https://dev.pageseeder.com/guide/publishing/using_ant.html
description: "This guide explains how to use Ant scripts in PageSeeder for upload, process, export, and publish tasks, with detailed setup instructions for Windows and Linux environments, including required dependencies and configuration examples."
last_updated: 2026-08-11T16:23:52+10:00
tokens: ~1261
---

# Using Ant

## Inside PageSeeder

Ant scripts can be invoked in PageSeeder through the Upload, Process, Export or Publish action icons or menu items. For information on configuring these see [PSML Ant scripts](../configuration/psml/psml_ant_scripts.md).

## Outside PageSeeder

Ant scripts can also be invoked outside PageSeeder, for example from a Windows or Linux command line using the following steps.

### Windows

1. If not installed already, **install** Java 11 or higher as follows:


  1. Go to [https://www.oracle.com/java](https://www.oracle.com/java) and **choose** Java for Developers / Java SE.
  2. **Download** the JDK or JRE .exe for windows (x64 for 64 bit) and run it.
2. **Download** a .zip binary distribution of Ant 1.10.12 or higher from [http://ant.apache.org/bindownload.cgi](https://ant.apache.org/bindownload.cgi).
3. **Unzip** Ant to a local folder (e.g. `c:\ant\apache-ant-1.10.12` ).
4. **Download** the `pageseeder-publish-api-x.jar` for your version of PageSeeder from [downloads](https://dev.pageseeder.com/download/install.html) and save it in a folder (e.g. `c:\ant\lib` ).
5. **Download** any **dependencies (see [below](using_ant.md))** and save them in a folder (e.g. `c:\ant\lib` ).
6. **Create** a build script (for example, `c:\ant\build.xml` ) with a `xmlns:ps="antlib:com.pageseeder.publishapi.ant"` attribute on the `<project>` element, see [examples](using_ant.md).
7. Enter the following on the Windows command line using the paths for the system (they can also be put into a batch file):

```batch
set ANT_HOME=c:\ant\apache-ant-1.10.12
set JAVA_HOME=c:\Program Files\Java\jdk-11.0.14
set PATH=%PATH%;%ANT_HOME%\bin
cd c:\ant
ant -lib lib
```

### Linux

1. If not installed already, **install** Java 11 or higher, for example, as follows:


  - OpenJDK (JDK 11)  
[http://openjdk.java.net/install/](http://openjdk.java.net/install)
$ su -c "yum install java-11-openjdk"


2. **Download** a binary distribution of Ant 1.10.12 or higher from [http://ant.apache.org/bindownload.cgi](https://ant.apache.org/bindownload.cgi).
3. **Decompress** Ant to a folder (e.g. `/opt/ant/apache-ant-1.10.12` ).
4. **Download** the `pageseeder-publish-api-x.jar` for your version of PageSeeder from [downloads](https://dev.pageseeder.com/download/install.html) and save it in a folder (e.g. `/opt/ant/lib` ).
5. **Download** any **dependencies (see [below](using_ant.md))** and save them in a folder (e.g. `/opt/ant/lib` ).
6. **Create** a build script (e.g. `/opt/ant/build.xml` ) with a `xmlns:ps="antlib:com.pageseeder.publishapi.ant"` attribute on the `<project>` element, see [examples](using_ant.md).
7. **Enter** the following on the Linux command line using the paths for the system (they can also be put into a script file):

```TEXT
export ANT_HOME=/opt/ant/apache-ant-1.10.12
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-[insert correct path]
export PATH=${PATH}:${ANT_HOME}/bin
cd /opt/ant
ant -lib lib
```

 

### Dependencies

To use the `pageseeder-publish-api-x.jar`, you need to download the following files:

- [pso-psml-\[latest version\].jar](https://search.maven.org/search?q=a:pso-psml)
- [pso-xmlwriter-1.1.x.jar](https://search.maven.org/artifact/org.pageseeder.xmlwriter/pso-xmlwriter)
- [slf4j-api-2.0.x.jar](https://search.maven.org/artifact/org.slf4j/slf4j-api)
- [slf4j-simple-2.0.x.jar](https://search.maven.org/artifact/org.slf4j/slf4j-simple)
- [pso-diffx-1.3.x](https://search.maven.org/artifact/org.pageseeder.diffx/pso-diffx) (for `diff` task)
- [Saxon-HE-12.x.jar](https://search.maven.org/artifact/net.sf.saxon/Saxon-HE) (for `process` and `transform` tasks)

## Examples

Following is an example `build.xml` file which could be used outside PageSeeder to upload documents and set their status to `In Progress`.

> **Note:** If there is more than one target, it can be specified after the Ant command, for example: ```shell ant -lib lib upload-specs ``` To display debug messages add the `-debug` option, for example: ```shell ant -lib lib -debug ```

 

```xml
<project name="example" default="upload-specs"
         xmlns:ps="antlib:com.pageseeder.publishapi.ant">   
  <target name="upload-specs" description="Upload specs">
    <ps:config file="pageseeder.properties" />
    <ps:upload group="example-specs"
               folder="documents"
               overwriteproperties="true"
               overwrite="true"
               unzip="true">
      <workflow status="In Progress" />
      <fileset dir="zip">
        <include name="mydocs.zip"/>
      </fileset>
    </ps:upload>
  </target>
</project>
```

The following file `pageseeder.properties` must be in the same folder as `build.xml`.

```properties
scheme=https
host=ps.example.com
port=443
site.prefix=/ps
client.id=87ff810b199f0636
client.secret=8G8gVEjxcGbWKLuCEYErxg
```

> **Note:** In PageSeeder v5 you must use `username` and `password` instead of the OAuth `client.id` and `client.secret` properties but this is less secure. In PageSeeder v6.2 or lower you must also add `servlet.prefix=/ps/servlet`

