Defining custom commands for Che-Theia

The Che-Theia IDE allows users to define custom commands in a devfile that are then available when working in a workspace.

This is useful, for example, for:

  • Simplifying building, running, and debugging projects.

  • Allowing lead developers to customize workspaces based on team requirements.

  • Reducing time needed to onboard new team members.

Che-Theia task types

The following is an example of the commands section of a devfile.


  - name: Package Native App
      - type: exec
        component: centos-quarkus-maven
        command: "mvn package -Dnative -Dmaven.test.skip"
        workdir: ${CHE_PROJECTS_ROOT}/quarkus-quickstarts/getting-started

  - name: Start Native App
      - type: exec
        component: ubi-minimal
        command: ./getting-started-1.0-SNAPSHOT-runner
        workdir: ${CHE_PROJECTS_ROOT}/quarkus-quickstarts/getting-started/target

  - name: Attach remote debugger
    - type: vscode-launch
      referenceContent: |
          "version": "0.2.0",
          "configurations": [
              "type": "java",
              "request": "attach",
              "name": "Attach to Remote Quarkus App",
              "hostName": "localhost",
              "port": 5005
Che commands

Package Native App and Start Native App

The Che commands are to be used to define tasks that will be executed in the workspace container.

  • The exec type implies that the Che runner is used for command execution. The user can specify the component in whose container the command is executed.

  • The command field contains the command line for execution.

  • The workdir is the working directory in which the command is executed.

  • The component field refers to the container where the command will be executed. The field contains the component alias where the container is defined.

VS Code launch configurations

Attach remote debugger

VS Code launch configurations are commonly used to define debugging configuration. To trigger these configurations, press F5 or choose Start Debugging from the Debug menu. The configurations provide information to the debugger, such as the port to connect to for debugging or the type of the application to debug (Node.js, Java, and others.).

  • The type is vscode-launch.

  • It contains the launch configurations in the VS Code format.

  • For more information about VS Code launch configurations, see the Debugging section on the Visual Studio documentation page.

Tasks of type che, also known as exec commands, can be executed from the Terminal→Run Task menu or by selecting them in the My Workspace panel. Other tasks are only available from Terminal→Run Task. Configurations to start with are available in the Che-Theia debugger.

Running and debugging

Che-Theia supports the Debug Adapter Protocol. This protocol defines a generic way for how a development tool can communicate with a debugger. It means Che-Theia works with all implementations.

  • A running instance of Che. To install an instance of Che, see Installing Che.


To debug an application:

  1. Click DebugAdd Configuration for debugging or adding of a launch configuration to the project.

    che theia basics 1
  2. From the pop-up menu, select the appropriate configuration for the application that you are about to debug.

    che theia basics 2
  3. Update the configuration by modifying or adding attributes.

    che theia basics 3
  4. Breakpoints can be toggled by selecting the editor margin.

    che theia basics 3 b
  5. After opening the breakpoint menu, use the Edit Breakpoint command to add conditions.

    che theia basics 3 c

    The IDE then displays the Expresion input field.

    che theia basics 3 d
  6. To start debugging, click View→Debug.

    che theia basics 4
  7. In the Debug view, select the configuration and press F5 to debug the application. Or, start the application without debugging by pressing Ctrl+F5.

    che theia basics 5

Editing a task and launch configuration


To customize the configuration file:

  1. Edit the tasks.json or launch.json configuration files.

  2. Add new definitions to the configuration file or modify the existing ones.

    The changes are stored in the configuration file.
  3. To customize the task configuration provided by plug-ins, select the TerminalConfigure Tasks menu option, and choose the task to configure. The configuration is then copied to the tasks.json file and is available for editing.