Jump to content
JasperReports Library 7.0 is now available ×
  • This documentation is an older version of JasperReports Server Community Project Administrator Guide. View the latest documentation.


    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.
    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 (/).


    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 Community Project 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: all repository resources, permissions, report jobs, users, and roles. If any server settings have been modified in the UI, those are also included.

    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.


    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.


    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 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.


    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 /reports/interactive/CustomersReport --output-dir myExport

    Export the /images and /reports folders:

    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 myExport.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 /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

    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 Community Project 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.

    All exports contain encrypted passwords. If you're importing to a different server, you must 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.


    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.


    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 some Release 5 server versions. If you need to import a custom theme, use the Theme UI to download it from the source server and upload it to the target server. In some cases, you may need to take more extensive steps. For more information, see Downloading and Uploading Theme ZIP Files.


    Import the myExport.zip catalog archive file:

    js-import --input-zip myExport.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 myExport.zip catalog archive file but ignore any users found in the catalog:

    js-import --input-zip myExport.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>_master.properties

    to: <js-install>/buildomatic/default_master.properties

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


    Oracle users can set the sysUsername and sysPassword to the same name as dbUsername and dbPassword in the default_master.properties. 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 default_master.properties file:

         <js-install>/buildomatic/build_conf/default/js.quartz.properties (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:


    Open topic with navigation

    User Feedback

    Recommended Comments

    There are no comments to display.

    This is now closed for further comments

  • Create New...