The colcon plugin

The colcon plugin is useful when building ROS 2 parts that use colcon.

Plugin-specific features and syntax are dependent on which base is being used, as outlined below:

This plugin uses the common plugin keywords as well as those for “sources”. For more information, see Snapcraft parts metadata.

base: core24

For core24, this plugin is designed to work with the ROS 2 Jazzy extension. If not using this extension, it is required to set the ROS_DISTRO environment variable to jazzy using build-environment.

This plugin enables the following plugin-specific keywords on core24:

  • colcon-ament-cmake-args (list of strings) Arguments to pass to ament_cmake packages. Note that any arguments here that match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-catkin-cmake-args (list of strings) Arguments to pass to catkin packages. Note that any arguments here which match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-cmake-args (list of strings) Arguments to pass to cmake projects. Note that any arguments here which match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-packages (list of strings) List of colcon packages to build. If not specified, all packages in the workspace will be built. If set to an empty list ([]), no packages will be built, which could be useful if you only want ROS debs in the snap.
  • colcon-packages-ignore (list of strings) List of packages for colcon to ignore.

base: core22

For core22, this plugin is designed to work with the ROS 2 Humble extension. If not using this extension, it is required to set the ROS_DISTRO environment variable to humble using build-environment.

This plugin enables the following plugin-specific keywords on core22:

  • colcon-ament-cmake-args (list of strings) Arguments to pass to ament_cmake packages. Note that any arguments here that match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-catkin-cmake-args (list of strings) Arguments to pass to catkin packages. Note that any arguments here which match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-cmake-args (list of strings) Arguments to pass to cmake projects. Note that any arguments here which match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-packages (list of strings) List of colcon packages to build. If not specified, all packages in the workspace will be built. If set to an empty list ([]), no packages will be built, which could be useful if you only want ROS debs in the snap.
  • colcon-packages-ignore (list of strings) List of packages for colcon to ignore.

base: core20

For core20, this plugin is designed to work with the ROS 2 Foxy extension. If not using this extension, it is required to set the ROS_DISTRO environment variable to foxy using build-environment.

This plugin enables the following plugin-specific keywords on core20:

  • colcon-ament-cmake-args (list of strings) Arguments to pass to ament_cmake packages. Note that any arguments here that match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-catkin-cmake-args (list of strings) Arguments to pass to catkin packages. Note that any arguments here which match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-cmake-args (list of strings) Arguments to pass to cmake projects. Note that any arguments here which match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-packages (list of strings) List of colcon packages to build. If not specified, all packages in the workspace will be built. If set to an empty list ([]), no packages will be built, which could be useful if you only want ROS debs in the snap.
  • colcon-packages-ignore (list of strings) List of packages for colcon to ignore.

base: core18

Snapcraft 7.x or lower is required to build core18 snaps. Snapcraft 8 does not support core18.
Switch with: sudo snap refresh snapcraft --channel=7.x/stable.

This plugin enables the following plugin-specific keywords on core18:

  • colcon-packages (list of strings) List of colcon packages to build. If not specified, all packages in the workspace will be built. If set to an empty list ([]), no packages will be built, which could be useful if you only want ROS debs in the snap.
  • colcon-source-space (string) The source space containing colcon packages (defaults to src).
  • colcon-rosdistro (string) The ROS distro to use. Available options are bouncy and crystal (defaults to crystal), both of which are only compatible with core18 as the base.
  • colcon-cmake-args (list of strings) Arguments to pass to cmake projects. Note that any arguments here which match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-catkin-cmake-args (list of strings) Arguments to pass to catkin packages. Note that any arguments here which match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.
  • colcon-ament-cmake-args (list of strings) Arguments to pass to ament_cmake packages. Note that any arguments here which match colcon arguments need to be prefixed with a space. This can be done by quoting each argument with a leading space.

Related Information

See the catkin plugin for building ROS 1 parts.

For a simple example, see ROS 2 applications, or search GitHub for projects already using the plugin.

This is a snapcraft plugin. See Snapcraft plugins and Supported plugins for further details on how plugins are used.


Last updated 4 months ago.