Skip to main content

 Publishing

Publishing PageSeeder data to print, the Web or both

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.

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  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 .
  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  and save it in a folder (e.g. c:\ant\lib ).
  5. Download any dependencies (see below) 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.
  7. 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.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:
  2. Download a binary distribution of Ant 1.10.12 or higher from http://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  and save it in a folder (e.g. /opt/ant/lib ).
  5. Download any dependencies (see below) 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.
  7. 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.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:

Examples

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

If there is more than one target, it can be specified after the Ant command, for example:

ant -lib lib upload-specs

To display debug messages add the -debug option, for example:

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

It is more secure to leave the password out of the properties file and 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>

In PageSeeder v6 or higher it is recommended to use the OAuth client.id and client.secret properties instead of username/password as these are more secure.

Created on , last edited on