Alternate Import-Export Scripts

Regardless of your installation method, JasperReports Server provides a third way to run import-export commands. Buildomatic is another command-line script that is based on the Apache Ant tool to automate installations. It includes targets (sub-commands) to perform import and export operations with the same options as the scripts. The following examples compare the two commands:

Shell Scripts: --everything


js-ant export-everything

Both types of scripts are located in the <js-install>/buildomatic folder.

Running Import from Buildomatic

The import target for ant has the following syntax:


js-ant import -DimportFile=<filename> [-DimportArgs="<import-options>"]

Linux and Mac OSX:

./js-ant import -DimportFile=<filename> [-DimportArgs=\"<import-options>\"]

The imported file is handled as a ZIP archive if its name ends in .zip, otherwise it's handled as a directory. The importArgs argument is optional and can contain more than one import option. On Linux, all double quotation marks (") must be escaped with a backslash (\).

When performing a large import using js-ant, the server should be stopped (or put into a mode with reduced load) to avoid issues with caches, configuration, and security.

The following examples are typical import commands on Windows:

js-ant import-help-pro
js-ant import
js-ant import -DimportFile=my-datasources -DimportArgs="--update"

The following examples are typical import commands on Linux:

./js-ant import-help-pro
./js-ant import
./js-ant import -DimportArgs=\"--update\"

Running Export from Buildomatic

The export target for ant has the following syntax:


js-ant export -DexportFile=<filename> -DexportArgs="<export-options>"

Linux and Mac OSX:

./js-ant export -DexportFile=<filename> -DexportArgs=\"<export-options>\"

The export file format is a ZIP file or a set of files under a new directory name. If you specify the .zip extension for your output filename, a ZIP archive is created automatically. Otherwise, an uncompressed directory with files and sub-directories is created.

The exportArgs argument requires double quotation marks (") and can contain more than one export option, as shown in these Windows examples:

js-ant export-help-pro
js-ant export
    -DexportArgs="--uris <MadCap:conditionalText data-mc-conditions="JasperConditions.Pro">/organizations/organization_1</MadCap:conditionalText>/datasources"
js-ant export
    -DexportArgs="--uris <MadCap:conditionalText data-mc-conditions="JasperConditions.Pro">/organizations/organization_1</MadCap:conditionalText>/reports
    --users jasperadmin<MadCap:conditionalText data-mc-conditions="JasperConditions.Pro">|organization_1</MadCap:conditionalText>,joeuser<MadCap:conditionalText data-mc-conditions="JasperConditions.Pro">|organization_1</MadCap:conditionalText>"
js-ant export -DexportFile=my-datasources
    -DexportArgs="--uris <MadCap:conditionalText data-mc-conditions="JasperConditions.Pro">/organizations/organization_1</MadCap:conditionalText>/datasources --roles ROLE_USER"
js-ant export -DexportArgs="--everything"

On Linux, all double quotation marks (") and other characters, such as the vertical bar (|) separating login user and organization names must be escaped with a backslash (\). Also, when listing user names, enclose the list in single quotation marks ('), as shown in this Linux example:

./js-ant export-help-pro
./js-ant export 
    -DexportArgs=\"--uris <MadCap:conditionalText data-mc-conditions="JasperConditions.Pro">/organizations/organization_1</MadCap:conditionalText>/reports
    --users 'jasperadmin<MadCap:conditionalText data-mc-conditions="JasperConditions.Pro">\|organization_1</MadCap:conditionalText>,joeuser<MadCap:conditionalText data-mc-conditions="JasperConditions.Pro">\|organization_1</MadCap:conditionalText>'\"