There are a number of maven plugins that measure code coverage:
Each of these measure coverage in slightly different ways and have different licenses. Which tool you use depends on your requirements.
This is a common question. The short answer is "because it is good for you". More detailed reasons are: