This paper applies a discrete adjoint gradient computation method to a multi-class traffic flow model on road networks, where vehicle classes are characterized by their speed functions. The resulting hyperbolic system of conservation laws is discretized using a Godunov-type finite volume scheme based on demand and supply functions, which extends to coupling conditions at junctions and boundary conditions. The optimization of the different travel metrics is accomplished through the definition of a minimization problem using the adjoint gradient method. Numerical simulations are also presented to illustrate the efficiency of the method on a test network.