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: |
js-export.sh --everything --output-file=js-catalog-exp.zip |
Buildomatic: |
js-ant export-everything -DexportFile=js-catalog-exp.zip |
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:
Windows: |
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 -DimportFile=my-reports.zip 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 -DimportFile=my-reports.zip ./js-ant import -DimportFile=my-datasources.zip -DimportArgs=\"--update\" |
Running Export from Buildomatic
The export target for ant has the following syntax:
Windows: |
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 -DexportFile=my-domains.zip -DexportArgs="--uris /organizations/organization_1/Domains" js-ant export -DexportFile=my-reports-and-users.zip -DexportArgs="--uris /organizations/organization_1/reports --users jasperadmin|organization_1,joeuser|organization_1" js-ant export -DexportFile=my-datasources -DexportArgs="--uris /organizations/organization_1/datasources --roles ROLE_USER" js-ant export -DexportFile=js-everything.zip -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 -DexportFile=my-reports-and-users.zip -DexportArgs=\"--uris /organizations/organization_1/reports --users 'jasperadmin\|organization_1,joeuser\|organization_1'\" |