In this article, we propose a control framework that enables robots to execute tasks persistently, i.e., over time horizons much longer than robots' battery life. This is achieved by ensuring that the energy stored in the batteries of the robots is never depleted. This condition is framed as a set invariance constraint in an optimization problem whose objective is that to minimize the difference between the robots' control inputs and nominal control inputs corresponding to the task that is to be executed. We refer to this process as the persistification of a robotic task. Forward invariance of subsets of the state space of the robots is turned into a control input constraint by using control barrier functions. The solution to the formulated optimization problem with energy constraints ensures that the robotic task is persistent. To illustrate the operation of the proposed framework, we consider two tasks whose persistent execution is particularly relevant: environment exploration and environment surveillance. We show the persistification of these two tasks both in simulation and on a team of wheeled mobile robots on the Robotarium.