In this paper, a task-based online path-planning and guidance system of underactuated unmanned underwater vehicles (UUVs) for inspection of underwater infrastructure is described. Whether there are harbor submerged structures, cables, pipes, hydro-technical works, they all need to be checked in relation to structural deterioration specific potential problems such as scour, erosion, and accelerated local corrosion problems. At the highest level, the mission controller handles different event types, permitting also the execution of mission tasks. The online path-planning module generates a set of waypoints based on an environmental perception module for the AUV to follow the target object with a constant distance. The guidance method actually controls the vehicle to follow the waypoints, assuming the relative position and attitude of the vehicle is precisely estimated in real-time. By combining these methods, an AUV can perform fully autonomous inspection of underwater structures. The system was evaluated with success for several harbor and pipeline inspection scenarios in a test basin and sea trials.