This bug report provides more insight on the situations in which the maven-checkstyle-plugin is unable to get the class information for exceptions that are declared by the project. This report is, therefore, a refinement of prior bug reports such as MPCHECKSTYLE-1, MPCHECKSTYLE-20, or
MCHECKSTYLE-54. We believe, however, that through a more in-depth study of the problem we can provide a narrower definition of the problem that, hopefully, will result in it resolution.
Our experiments have shown that the maven-checkstyle-plugin fails for classes or interfaces that contain method signatures with a "throws" clause pointing to exception defined by both the project and elsewhere. This is demonstrated by the interface "ch.ethz.globis.demo.Demo" contained in the attached demo project.
public interface Demo
void foo() throws DemoException, IOException, FileNotFoundException;
void foofoo() throws DemoException;
void bar() throws IOException, FileNotFoundException, IllegalArgumentException;
If the command "mvn checkstyle:check" is executed in the project, it will fail with one checkstyle violation. If, however, the method "foo()" is commented (or removed), everything works fine. Note that method "foofoo()" which only declares "ch.ethz.globis.demo.DemoException" is unproblematic as well as method "bar()" which declares a set of exceptions that are declared outside the project. Hence, the conclusion is that it is the combination of both project and outside-project exceptions that make the maven-checkstyle-plugin fail. Note that we have run maven on clean installation (where the local repository has been removed first) to produce a reproducible error.
The attached zip file contains both the demo project that can be used to reproduce the error as well as the output of the "mvn checkstyle:check" command under "target". We also provide the file "output.txt" that documents the console output of the command. If further documentation is required, do not hesitate to contact me. We hope that by providing this information we can contribute to the resolution of said issue, once and for all.