How to filter the execution of your project on selected Jobs using Maven - 7.0

Talend Software Development Life Cycle Best Practices Guide

author
Talend Documentation Team
EnrichVersion
7.0
EnrichProdName
Talend Big Data
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
task
Administration and Monitoring
Deployment
Design and Development
EnrichPlatform
Talend Administration Center
Talend Artifact Repository
Talend CommandLine
Talend JobServer
Talend Studio
How to filter the execution of your project items to build only the Job(s) you want. To do that, you need to declare the filter in the Maven parameters entered when configuring the build project which generates your project sources on the Continuous Integration server.

Before you begin

  • You have created the build project on your Continuous Integration server, Jenkins for example. See Creating the Jenkins project.
  • You know the path to the pom files of the Jobs you want to execute. These files are available in the Studio workspace, in the workspace/<my_project>/poms directory.

Procedure

  1. Open the configuration page of the build project.
  2. In the Goals and options field of the Build area (plugin execution information as well as parameters needed to generate the sources), enter the Maven commands that allow you to filter the Jobs according to your needs:
    • -pl to generate Jobs and related Tests that are located in a specific project (if you have more than one projects in your repository).

      Ex:

      -pl CI_PROJECT to generate all Jobs and Tests located in the project named CI_PROJECT.

      \jobs\process\job_feature400_0.1 -pl CI_PROJECT to generate the Job named job_feature400_0.1 located in the project named CI_PROJECT.

    • -am (if the project has been specified with -pl) to generate the child dependencies of a specific Job.

      Ex:

      \jobs\process\parent_job_feature334_0.1 -pl CI_PROJECT -am to generate the parent Job named parent_job_feature334_0.1 as well as its child Job (child_job_feature334_0.1) and sub-child Job (subchild_job_feature334_0.1).

    • -amd (if the project has been specified with -pl) to generate the parent dependencies of a specific Job.

      Ex:

      \jobs\process\subchild_job_feature334_0.1 -pl CI_PROJECT -amd to generate the sub-child Job subchild_job_feature334_0.1 that has been modified and re-generate the Jobs that depend on this one, child_job_feature334_0.1) and parent_job_feature334_0.1).
      Note: As the -amd command builds all modules that depend on the specified Job, all the dependencies needed to generate this Job, such as routines, need to be pre-generated.

    Example of Maven command used to clean the project build directory (deleting old files), launch the generation of all Jobs and Tests in the CI_PROJECT project and package the Java code in an output file (.jar, .war, .zip, etc).

    mvn clean package -pl CI_PROJECT -am

    Example of Maven command used to clean the project build directory (deleting old files), launch the generation of all existing Jobs and Tests and deploy the packages on the snapshots Nexus repository :

    mvn clean deploy -DaltDeploymentRepository=snapshots::default::http://localhost:8081/repository/snapshots
  3. Save your changes and close the configuration page.

Results

When you will execute your project on your Continuous Integration server, the filter will be applied and only the Jobs you have filtered will be generated and executed.