  An exact solution to the lock-exchange problem, which is a two-layer analogue
of the classical dam-break problem, is obtained in the shallow-water (SW)
approximation for two immiscible fluids with slightly different densities. The
problem is solved by the method of characteristics using analytic expressions
for the Riemann invariants. The obtained solution, which represents an inviscid
approximation to the high-Reynolds-number limit, is in general discontinuous
containing up to three hydraulic jumps which are due to either multivaluedness
or instability of the continuous SW solution. Hydraulic jumps are resolved by
applying the Rankine-Hugoniot conditions for the SW mass and generalized
momentum conservation equations. The latter contains a free parameter $\alpha$
which defines the relative contribution of each layer to the interfacial
pressure gradient. We consider a solution for $\alpha=0,$ which corresponds to
both layers affecting the interfacial pressure gradient with equal weight
coefficients. This solution is compared with the solutions resulting from the
application of the classical Benjamin's front condition as well as the
circulation conservation condition, which correspond to $\alpha=-1$ and
$\alpha\rightarrow\infty,$ respectively. The SW solution reproduces all
principal features of 2D numerical solution for viscous fluids. The gravity
current speed is found to agree well with experimental and numerical results
when the front acquires the largest stable height which occurs at
$\alpha=\sqrt{5}-2.$ We show that two-layer SW equations for the mass and
generalized momentum conservation can describe interfacial waves containing
hydraulic jumps in a self-contained way without external closure conditions.
