jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2.x Checkstyle Plugin
  • MCHECKSTYLE-48

regression: report generation doesn't work while dealing with the header file

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.2
  • Labels:
    None
  • Environment:
    Checkstyle 2.2-SNAPSHOT rev 419829.

Description

Configured as is:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>config/maven_checks.xml</configLocation>
</configuration>
</plugin>

Checkstyle stopped working. I made a fresh svn update and mvn checkstyle:checkstyle fails with:

[...]
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module TreeWalker - Cannot set property 'headerFile' in module RegexpHeader to '/home/jerome/Dev/OSS/perso/jar-info/target/checkstyle-header.txt': line 24 in header specification is not a regular expression
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:165)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:209)
at org.apache.maven.plugin.checkstyle.CheckstyleReport.executeCheckstyle(CheckstyleReport.java:729)
at org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:490)
[...]
Caused by: org.apache.commons.beanutils.ConversionException: line 24 in header specification is not a regular expression
at com.puppycrawl.tools.checkstyle.checks.header.RegexpHeaderCheck.initHeaderRegexps(RegexpHeaderCheck.java:116)
at com.puppycrawl.tools.checkstyle.checks.header.RegexpHeaderCheck.setHeaderFile(RegexpHeaderCheck.java:85)
... 34 more

Full log attached.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    mvn.log
    07/Jul/06 2:02 AM
    17 kB
    Jerome Lacoste

Issue Links

is depended upon by

Bug - A problem which impairs or prevents the functions of the product. MCHECKSTYLE-108 If I use the default maven checkstyle config, I can't use my own license header

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
relates to

Bug - A problem which impairs or prevents the functions of the product. MCHECKSTYLE-108 If I use the default maven checkstyle config, I can't use my own license header

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Dennis Lundberg added a comment - 16/Jul/06 8:23 AM

I also stumbled on this today. After some serious digging I found a workaround for it. If you add
<headerLocation>config/maven-header.txt</headerLocation>
to your configuration it works.

Now, on to the real problem. It seems to be the "magical" Locator, that:

"Checks a location string to for a resource, URL, or File that matches.
If a resource or URL is found, then a local file is created with that locations contents."

The problem here is the "location" which in this case is set to "LICENSE.txt" (i.e. the default value for headerLocation). Now, if your project does not contain such a file, the Locator tries to find this in some other magical way and downloads it if it finds it.

In my case I ended up with the license file for "JSch 0.0.*" in target/checkstyle-header.txt! So check the contents of that file. And this is what debug tells us:

[DEBUG] resolveLocation(LICENSE.txt, checkstyle-header.txt)
[DEBUG] Location is not a URL.
[DEBUG] Location is not a File.
[DEBUG] Potential Resource: jar:file:/C:/Program/maven-2.0.5-SNAPSHOT/lib/jsch-0.1.24.jar!/LICENSE.txt

A solution for the maven_checks problem would be to change the default value of headerFile to "config/maven-header.txt" if the user has configured the plugin to use "config/maven_checks.xml"

Show
Dennis Lundberg added a comment - 16/Jul/06 8:23 AM I also stumbled on this today. After some serious digging I found a workaround for it. If you add <headerLocation>config/maven-header.txt</headerLocation> to your configuration it works. Now, on to the real problem. It seems to be the "magical" Locator, that: "Checks a location string to for a resource, URL, or File that matches. If a resource or URL is found, then a local file is created with that locations contents." The problem here is the "location" which in this case is set to "LICENSE.txt" (i.e. the default value for headerLocation). Now, if your project does not contain such a file, the Locator tries to find this in some other magical way and downloads it if it finds it. In my case I ended up with the license file for "JSch 0.0.*" in target/checkstyle-header.txt! So check the contents of that file. And this is what debug tells us: [DEBUG] resolveLocation(LICENSE.txt, checkstyle-header.txt) [DEBUG] Location is not a URL. [DEBUG] Location is not a File. [DEBUG] Potential Resource: jar:file:/C:/Program/maven-2.0.5-SNAPSHOT/lib/jsch-0.1.24.jar!/LICENSE.txt A solution for the maven_checks problem would be to change the default value of headerFile to "config/maven-header.txt" if the user has configured the plugin to use "config/maven_checks.xml"
Hide
Permalink
Dennis Lundberg added a comment - 02/Feb/08 5:27 PM

I have implemented a workaround, as described earlier. Committed in r617926.

Show
Dennis Lundberg added a comment - 02/Feb/08 5:27 PM I have implemented a workaround, as described earlier. Committed in r617926.

People

  • Assignee:
    Dennis Lundberg
    Reporter:
    Jerome Lacoste
Vote (0)
Watch (0)

Dates

  • Created:
    07/Jul/06 2:02 AM
    Updated:
    13/May/09 10:43 AM
    Resolved:
    02/Feb/08 5:27 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.