I hate typing - so these are the aliases in my ~/.bashrc
for my most common workflow:
alias build2="colcon build --symlink-install"
alias test2="colcon test --event-handlers console_direct+"
colcon is used to build ROS 2 packages in a workspace.
Build all packages:
colcon build
To avoid having to rebuild when tweaking Python scripts, config files, and launch files:
colcon build --symlink-install
To fix most build issues, especially if you have added or removed packages to your workspace or installed new RMW implementations, clean the CMake cache. See this ROS Answers post for more details.
colcon build --cmake-clean-cache
colcon build --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
To test and get results to screen:
colcon test
colcon test-result --verbose
Build/test a single package:
colcon <verb> --packages-select <package-name>
Get the output to the screen:
colcon <verb> --event-handlers console_direct+
You should probably build your workspace in a window where you have NOT sourced the setup.bash of that workspace. For more details on why, see this ticket.