Customizing Maven build script templates

Talend ESB Studio User Guide

EnrichVersion
6.5
EnrichProdName
Talend ESB
task
Design and Development
EnrichPlatform
Talend Studio

Your Talend Studio provides the following default templates for generating build scripts:

  • Maven script templates for standalone Job export

  • A Maven script template for OSGI bundle export of Jobs

  • Maven script templates for Karaf export of Routes

  • Maven script templates for Karaf export of Services

Based on the default, global build templates, you can create folder-level build scripts. Build scripts generated based on these templates are executed when building Jobs, Routes or Services.

This section provides information on how to customize the build script templates. For information on how to build a Job, Route and Service, see How to build Jobs, How to build Routes and How to export a Service for deployment.

How to customize the global build script templates

In the [Project Settings] dialog box, you can find and customize the default, global build script templates under the Build > Maven > Default node. These script templates apply to all Jobs in the root folder and all sub-folders except those with their own build script templates set up.

The following example shows how to customize the global POM script template for standalone Jobs:

  1. From the menu bar, click File > Edit Project properties to open the [Project Settings] dialog box.

  2. Expand the Build > Maven > Default nodes, and then click the Standalone Job node to open the relevant view that displays the content of the POM script template.

    Note

    Depending on the license you are using, the project settings items in your Studio may differ from what is shown above.

  3. Modify the script code in the text panel and click OK to finish your customization.

How to customize the folder-level build script templates

Based on the global build script templates, you can add and customize script templates for Jobs folder by folder under the Build > Maven > Setup custom scripts by folder node. The build script templates added for a folder apply to all Jobs in that folder and all its sub-folders except those with their own build script templates set up.

The following example shows how to add and customize the POM script template for building standalone Jobs from Jobs in the CA_customers folder:

  1. From the menu bar, click File > Edit Project properties to open the [Project Settings] dialog box.

  2. Expand the Build > Maven > Setup custom scripts by folder > Job Designs > CA_customers nodes, and then click the Standalone Job node to open the relevant view, from which you can add script templates or delete all existing templates.

    Note

    Depending on the license you are using, the project settings items in your Studio may differ from what is shown above.

  3. Click the Create Maven files button to create script templates based on the global templates for standalone Jobs.

  4. Select the script template you want to customize, pom.xml in this example, to display the script code in the code view. Modify the script code in the text panel and click OK to finish your customization.

    Once the build script templates are created for a folder, you can also go to the directory where the XML files are stored, <studio_installation_directory>\workspace\<project_name>\process\CA_customers in this example, and directly modify the XML file of the template you want to customize. Your changes will affect all Jobs in the folder and in all sub-folders except those with their own script set up.

    Warning

    If you are working in a remote project and if you modify an XML file directly, your changes will not be automatically committed to the version control system. To make sure your changes are properly committed, we recommend that you customize the script templates in Project Settings of your Talend Studio instead.

How to customize build script templates for use with CommandLine

If you want to customize a build script template for the use with the CommandLine, which is the equivalent of the Talend Studio without GUI, go to the directory where the script file is stored, for example, <studio_installation_directory>\workspace\<project_name>\process\CA_customers. Then, customize the script file according to your need.

The modified script file will be taken into account when a Job, Route or Service is built with the Maven option activated.

Note

There is no direct customization to the global build script templates for use with the CommandLine. As a workaround, you can add template files in the root directory <studio_installation_directory>\workspace\<project_name>\process\ for Jobs, <studio_installation_directory>\workspace\<project_name>\routes\ for Routes, or <studio_installation_directory>\workspace\<project_name>\services\ for Services, and then and modify the XML files. Note that these script templates will apply to all Jobs, Routes or Services in all folders except those with their own build script templates set up.

For more information about the CommandLine, see Appendix A of the Talend Administration Center User Guide.