Import and Export Through the Command Line

If you installed JasperReports Server from the binary installer, the command-line utilities were configured by the installer. If you installed the WAR file distribution, you must follow the instructions in Configuring Import-Export Utilities before you can run the utilities.

The import and export utilities are shell scripts located in the <js-install>/buildomatic folder:





The examples in this chapter use the shortened Windows commands without the optional .bat extension on the command line. If you're running JasperReports Server on Linux, be sure to add the .sh file extension.

When using the import and export utilities, keep the following in mind:

JasperReports Server should be stopped when using the import and export utilities. This is very important for the import utility to avoid issues with caches, configuration, and security.
All command line options start with two dashes (--).
You must specify either a directory or a zip file to export to or import from.
If you're importing to a different server, configure an encryption key on both servers, as described in Setting the Import-Export Encryption Key. Then enter the keystore password when prompted by the import command.
If you're exporting or importing organizations, you must be aware of resource dependencies outside of the organization that may block the operation. For more information, see Dependencies During Import and Export.
Make sure the output location specified for an export is writable to the user running the command.
All URIs are repository paths originating at the root (/). In commercial editions of the server, even those with a single default organization, the path must include the organization unless you specify the --organization option, for example:


The import and export scripts provide access to the repository and internal database of the server. Even though all passwords are encrypted during export, a catalog may still contain sensitive URLs and data. You should set permissions on the host file system and operating system to secure the scripts and any catalogs you export.

Exporting From the Command Line

Usage: js-export [OPTIONS]

We recommend you stop your server instance before running the export utility. For instructions see the JasperReports Server Installation Guide.

Specifies repository resources such as reports, images, folders, and scheduled jobs to export. You can also export the internal definitions for scheduled jobs, users, roles, and audit data. The export output is known as a repository catalog. It's either a zip archive file or a set of files in a folder structure.

Options in js-export Command




Exports everything except audit and monitoring data: all repository resources, permissions, report jobs, organizations, users, and roles. If any server settings have been modified in the UI, those are also included. May be combined with --organization to export everything in just one organization.

This option is equivalent to:
--uris --repository-permissions --report-jobs --calendars --users --roles


Displays brief information about the available options.


Exports repository events (date, time, and user name of last modification).


Path of a location to export the catalog in a folder structure.


Path and filename to export the catalog as a zip file.


Comma separated list of repository report unit and folder URIs for which report unit jobs should be exported. For a folder URI, this option exports the scheduled jobs of all reports in the folder and all subfolders.


When specified, the export includes any and all calendars of all types (holiday, recurring, ...) defined in the scheduler. When calendars are present in an export catalog, they're always processed and added upon import.


Comma separated list of folder or resource URIs to export from the repository. If the URI specifies a folder, the export operation exports all resources and folders contained in the folder. In addition, it recurses through all its subfolders.

--resource-types Comma separated list of resource types to export. The available resource types are: adhocDataView, awsDataSource, beanDataSource, customDataSource, dashboard, dataType, file, folder, inputControl, jdbcDataSource, jndiJdbcDataSource, listOfValues, mondrianConnection, mondrianXmlaDefinition, olapUnit, query, reportUnit, virtualDataSource, xmlaConnection.


This option exports repository permissions with each exported resource or folder. This option should only be used in conjunction with --uris.

--skip-dependent-resources Exports resources without their dependencies, for example a report without its external data source, input control definitions, or image files.
--organization Specify the ID of an organization to export. When specified, only resources, users, and roles from this organization (and its suborganizations) are exported. When specified, all URIs are relative to this organization.
--skip-suborganizations When used with --organization, specifies that suborganizations (and their resources, users, and roles) should not be exported.


Comma separated list of roles to export. If no roles are specified with this option, all roles are exported.


Use only with --roles. This option exports all users belonging to each exported role.


Comma separated list of users to export; if no users are specified with this options, all users are exported. Exporting a user includes all user attributes and all roles assigned to each user. When specifying users, you must give their organization ID if applicable, for example:

--users superuser, "jasperadmin|organization_1"


Use only with --users. This option exports all roles belonging to each exported user.

--include-attributes Specify this flag to export attributes on any user, organization, or root level that is exported.
--skip-attribute-values When used with --include-attributes, specifies that only attribute names are exported, values will be null.


Includes audit data for all resources and users in the export.


Includes monitoring data for all resources and users in the export.

User passwords are encrypted during the export by default, but exported catalogs may contain sensitive data. Take appropriate measures to secure the catalog file from unauthorized access.


Export everything in the repository:

js-export --everything --output-dir myExport

Export the /reports/interactive/CustomersReport report unit to a catalog folder:

js-export --uris /organizations/organization_1/reports/interactive/CustomersReport --output-dir myExport

js-export --uris /reports/interactive/CustomersReport --output-dir myExport

Export the /images and /reports folders:

js-export --uris /organizations/organization_1/images /organizations/organization_1/reports --output-dir myExport

js-export --uris /images /reports --output-dir myExport

Export all resources (except users, roles, and job schedules) and their permissions to a zip catalog:

js-export --uris / --repository-permissions --output-zip

Export all resources and report jobs:

js-export --uris / --report-jobs / --output-dir myExport

Export the report jobs of the /reports/interactive/CustomersReport report unit:

js-export --report-jobs /organizations/organization_1/reports/interactive/CustomersReport --output-dir myExport

js-export --report-jobs /reports/interactive/CustomersReport --output-dir myExport

Export all roles and users:

js-export --roles --users --output-dir myExport

Export the ROLE_USER and ROLE_ADMINISTRATOR roles along with all users belonging to either role:

js-export --roles ROLE_USER, ROLE_ADMINISTRATOR --role-users --output-dir myExport

Export all resources in an organization, but not its suborganizations:

js-export --organization organization_1 --skip-suborganizations --uris /

The folder named Temp at the root and in every organization is a special folder. None of the folders or resources in a Temp folder are exported.

Importing From the Command Line

See Import and Export Through the Command Line for guidelines when running the command-line utilities.

When using the js-import command line utility, the server must be stopped to avoid issues with caches, configuration, and security. For instructions see the JasperReports Server Installation Guide.

Usage: js-import [OPTIONS]

Reads a repository catalog from your file system and creates the resources in the JasperReports Server repository. The repository catalog must be one created by the export interface or the js-export command, either as a ZIP archive file or a folder structure.

As of JasperReports Server 5.5, all exports contain encrypted passwords and if you're importing to a different server, configure an encryption key on both servers. See Setting the Import-Export Encryption Key for details.

Options in js-import Command




Displays brief information about the available options.


Path for importing a catalog from a directory.


Path and filename for importing a catalog from a zip file.


Resources in the catalog replace those in the repository if their URIs and types match.


When used with --update, users in the catalog are not imported or updated. Use this option to import catalogs without overwriting currently defined users.

--organization If the import catalog is from an organization, specifies the target organization where it should be imported. The organization ID should match the ID of the organization in the import catalog, if not, use the --merge-organizaiton option.
--merge-organization Use this options when --organization is specified but it does not match the ID of the organization in the import catalog. When merging organizations, the contents of the import override the target organization for any user, role or resource with the same name. A merged organization takes the organization ID of the imported organization.

Specifies the action to take when importing a resource with a broken dependency. One of the following values:

skip – Does not import the resource with the broken dependency, but continues to import other resources.
include – Attempts to import the resource with the broken dependency. The import succeeds if there is already a resource in the destination that satisfies the dependency. If the dependency is not satisfied in the destination, the resource is skipped and the import continues.
cancel – Stops the import operation.


Restores access events (date, time, and username of last modification) on imported resources.


Imports any audit data in the catalog.


Imports any monitoring data in the catalog.


Determines whether the system configuration is updated from the catalog. There are two prerequisites for the catalog to contain configuration settings:

The originating server settings must be modified through the UI (Log Settings, Ad Hoc Settings, Ad Hoc Cache, and OLAP Settings). For more information, see Configuration Settings in the User Interface.
The catalog must be exported with the “everything” option from the user interface or the command-line utility.

Imported server settings take effect when the server is started.

--skip-themes This flag is required when importing a catalog that includes a theme from a server version 5.2 or before to version 5.5 or later. If you have a custom theme to import, you can use the Theme UI to download it from the source server and upload it to the target server. If your theme contains the file pageSpecific.css, you must remove it from the ZIP file before uploading, and then redo your changes to the file based on pageSpecific.css in the target server from 5.5 or later. For more information, see Downloading and Uploading Theme ZIP Files.


Import the catalog archive file:

js-import --input-zip

Import the myDir catalog folder, replacing existing resources if their URIs and types match those found in the catalog:

js-import --input-dir myDir --update

Import the catalog archive file but ignore any users found in the catalog:

js-import --input-zip --update --skip-user-update

Import the myDir catalog folder with access events:

js-import --input-dir myDir --include-access-events

When a resource in the target repository has the same URI as on that you're importing, the default behavior is leave the existing resource unchanged (no overwriting occurs).

To delete the existing resource and replace it with a new one (of the same type and with the same URI), use the --update option. Note that, if the resource in the export catalog is a different type than the existing resource, the server returns an error and skips the update operation.

When you import a user whose roles exist in the repository, the user is given those roles. User properties are imported with the user.

When you import access events, the date and time of the last modification before export is restored on import for every resource. The catalog folder has to be created with access events. If you don't import access events, or if they don't exist in the imported files, the date and time of the import are used.

Configuring Import-Export Utilities

If you installed JasperReports Server from the binary installer, the import-export utilities were configured by the installer. If you installed the WAR file distribution, you must configure several files before you can use the import-export utilities.

Alternatively, see Alternate Import-Export Scripts because the alternate scripts don't require any configuration, regardless of the installation method.

To configure the import-export utilities:

1. Depending on the database you use, copy the installation configuration file:

from: <js-install>/buildomatic/sample_conf/<database>

to: <js-install>/buildomatic/

2. Edit the file to set values specific to your installation. For more information about the settings in this file, see the JasperReports Server Installation Guide.

Oracle users can set the sysUsername and sysPassword to the same name as dbUsername and dbPassword in the The system user name and password are not required because js-import and js-export do not make changes to the database schema.

3. Run the following command:

js-ant clean-config gen-config

This command will generate the following files with the values you added to the file:

     <js-install>/buildomatic/build_conf/default/ (only for DB2 and PostgreSQL)
4. Make sure the JDBC driver for your database is located in the following folder:


If necessary, you can find links for downloading JDBC drivers from the Jaspersoft Community website: