Using Ant
Inside PageSeeder
Ant scripts can be invoked in PageSeeder via the Upload, Process, Export or Publish action icons or menu items. For information on configuring these see PSML Ant scripts.
Outside PageSeeder
Ant scripts can also be invoked outside PageSeeder, for example from a Windows or Linux command line using the steps below.
Windows
- If not installed already, install Java 8 or later as follows:
- Go to https://www.oracle.com/java and choose Java for Developers / Java SE.
- Download the JDK or JRE .exe for windows (x64 for 64 bit) and run it.
- Download a .zip binary distribution of Ant 1.8.1 or later from http://ant.apache.org/bindownload.cgi
- Unzip Ant to a local folder (e.g.
c:\ant\apache-ant-1.9.7
). - Download the
pageseeder-publish-api-x.jar
for your version of PageSeeder from downloads and save it in a folder (e.g.c:\ant\lib
). - Download any dependencies (see below) and save them in a folder (e.g.
c:\ant\lib
). - Create a build script (e.g.
c:\ant\build.xml
) with axmlns:ps="antlib:com.pageseeder.publishapi.ant"
attribute on the<project>
element, see below for examples. - Enter the following on the Windows command line using the paths for the system (they can also be put into a batch file):
set ANT_HOME=c:\ant\apache-ant-1.9.7 set JAVA_HOME=c:\Program Files\Java\jdk1.8.0_92 set PATH=%PATH%;%ANT_HOME%\bin cd c:\ant ant -lib lib
Linux
- If not installed already, install Java 8 or later, for example as follows:
- OpenJDK (JDK 8)
http://openjdk.java.net/install/$ su -c "yum install java-1.8.0-openjdk"
- Download a binary distribution of Ant 1.8.1 or later from http://ant.apache.org/bindownload.cgi
- Decompress Ant to a folder (e.g.
/opt/ant/apache-ant-1.9.7
). - Download the
pageseeder-publish-api-x.jar
for your version of PageSeeder from downloads and save it in a folder (e.g./opt/ant/lib
). - Download any dependencies (see below) and save them in a folder (e.g.
/opt/ant/lib
). - Create a build script (e.g.
/opt/ant/build.xml
) with axmlns:ps="antlib:com.pageseeder.publishapi.ant"
attribute on the<project>
element, see below for examples. - Enter the following on the Linux command line using the paths for the system (they can also be put into a script file):
export ANT_HOME=/opt/ant/apache-ant-1.9.7 export JAVA_HOME=/usr/local/jdk1.8.0_92 export PATH=${PATH}:${ANT_HOME}/bin cd /opt/ant ant -lib lib
Dependencies
To use he pageseeder-publish-api-x.jar
you need to download the following files:
Examples
Below 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: e.g.
ant -lib lib upload-specs
To display debug messages add the -debug
option: e.g.
ant -lib lib -debug
<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
.
scheme=https host=ps.example.com port=443 servlet.prefix=/ps/servlet site.prefix=/ps username=jsmith password=mypassword
If the password is to be left out of the properties file, add the following after <ps:config file="pageseeder.properties" />
<input message="password?" addproperty="ps.config.default.password"> <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> </input>
Created on , last edited on