maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David M. Karr" <>
Subject Why is checkstyle failing on one project, but not others?
Date Thu, 14 Jan 2016 23:59:24 GMT
This may be a checkstyle-specific problem, but I'll start with the maven 
checkstyle plugin.

I'm integrating a large codebase into another larger project that has 
checkstyle standards.  After I added the parent pom spec to the 
top-level pom and ran the build, I noticed it successfully built several 
subprojects, but then fail with a checkstyle error on one subproject, 
perhaps the 10th subproject.  The error was in the verification of the 
license header.

I carefully examined the license header in the file, and then compared 
it to the header in one file in one of the subprojects that didn't get 
an error.  They were identical.  I did a "diff" on them to be certain.  
All of the existing files in the codebase have the same license header.

I thought the issue was that this file was failing and it shouldn't be 
failing.  However, when I actually looked closer at the regexp that it 
said wasn't matching, I realized that that the actual issue was that the 
projects that passed the checkstyle test should NOT have passed, because 
the specified license template did not match the header in the files.

I then looked at the pom file for the failing project and the first one 
that wasn't failing.  Except for the artifact name, they were identical, 
except for the fact that the failing subproject has their source 
directory as "src" instead of "src/main/java" (I didn't write this).  I 
looked carefully at the build output for the "passing" project, and it 
showed it executing the checkstyle plugin and reporting no errors.

So before I fix all of these license headers to match their standard (or 
argue that the template is overly specific), I'd like to truly 
understand what's happening here.

For details, here is the header from the file that is failing:
  * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights 
  *  This program and the accompanying materials are made available 
under the
  *  terms of the Eclipse Public License v1.0 which accompanies this 
  *  and is available at

And here is the "LICENSE.txt" file that is used for verification in the 
checkstyle configuration:
^ \* Copyright (\([cC]\)|©) [0-9]{4}(, [0-9]{4})? .* All rights reserved.$
^ \*( )?$
^ \* This program and the accompanying materials are made available 
under the$
^ \* terms of the Eclipse Public License v1.0 which accompanies this 
^ \* and is available at$
^ [*]+/$

As you can see (from careful inspection), the third line in the header 
has two spaces after the "*", but the template clearly only allows one.  
When I run the build in the project that is failing the check, it gives 
me the following, which I now understand to be "correct":
[INFO] --- maven-checkstyle-plugin:2.16:check (check-license) @ ---
[INFO] Starting audit...
Line does not match expected header line of '^ \*( )?$'.
Audit done.
[INFO] There is 1 error reported by Checkstyle 6.2 with 
check-license.xml ruleset.
[ERROR] src/com/cisco/yangide/m2e/yang/tests/[3] 
(header) RegexpHeader: Line does not match expected header line of '^ 
\*( )?$'.

However, the following is the output I see for all the other 
subprojects, which are all in the build output before this failing one:
[INFO] --- maven-checkstyle-plugin:2.16:check (check-license) @ ---
[INFO] Starting audit...
Audit done.
[INFO] --- maven-checkstyle-plugin:2.16:check (default) @ ---
[INFO] Starting audit...
Audit done.

Any idea what's going on here?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message