Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkstyle Additional Property checkstyle.header.file points to wrong LICENSE.txt #83

Closed
vorburger opened this issue Apr 19, 2016 · 2 comments

Comments

@vorburger
Copy link
Member

commented Apr 19, 2016

When using m2e-code-quality on https://git.opendaylight.org/gerrit/gitweb?p=odlparent.git;a=tree to configure Checkstyle using https://github.com/vorburger/opendaylight-eclipse-setup, then you get the following error:

Checkstyle: org.apache.commons.beanutils.ConversionException: line 83 in header specification is not a regular expression 
    at com.puppycrawl.tools.checkstyle.checks.header.RegexpHeaderCheck.postProcessHeaderLines(RegexpHeaderCheck.java:160)

This is because the <property name="checkstyle.header.file" in the /.checkstyle file generated into a project such as odlparent/features-test points to a file like /home/vorburger/dev/ODL-byOomph/ws/.metadata/.plugins/org.eclipse.core.resources/.projects/org.opendaylight.odlparent.features-test/com.basistech.m2e.code.quality.checkstyleConfigurator/checkstyle-header-check-license.txt - but that file is wrong; instead of the https://git.opendaylight.org/gerrit/gitweb?p=odlparent.git;a=blob;f=checkstyle/src/main/resources/LICENSE.txt;h=e9622c210831a0ac4c2b90d51c0f3ed26bb35549;hb=HEAD short TXT with regexp, it's a full ASL TXT (which is not a regexp, thus the error above).

Something is wrong somewhere, likely in the code around https://github.com/m2e-code-quality/m2e-code-quality/pull/15/files (but note this project's pom.xml does NOT even use headerLocation..), causing it to pick out an Apache License TXT instead of the correct license regexp from the classpath of a dependency of the maven-checkstyle-plugin. Note that Apache License TXT is NOT even in the source tree (i.e. it's NOT e.g. https://git.opendaylight.org/gerrit/gitweb?p=odlparent.git;a=blob;f=license/src/main/resources/LICENSE;h=82d2ab25c6f9119c2aba61dc3f74a21295f0315f;hb=HEAD), but m2e-code-quality appears to, wrongly, fish it out of one of its/another one's JAR file, somewhere.

@vorburger

This comment has been minimized.

Copy link
Member Author

commented Apr 19, 2016

Debugging: The problem is the this.resourceResolver.resolveLocation() call in com.basistech.m2e.code.quality.checkstyle.MavenPluginConfigurationTranslator.getHeaderFile() which for the argument "LICENSE.txt" returns jar:file:/home/vorburger/.m2/repository/org/apache/maven/plugins/maven-checkstyle-plugin/2.16/maven-checkstyle-plugin-2.16.jar!/LICENSE.txt instead of the one from https://git.opendaylight.org/../odlparent/checkstyle/src/main/resources/LICENSE.txt as CLI mvn seems to do.

@vorburger

This comment has been minimized.

Copy link
Member Author

commented Apr 19, 2016

#87 log WARN to clarify this, but not fix it.

https://git.opendaylight.org/gerrit/#/c/37842/ works around this problem simply by using another file name than the default LICENSE.txt.

Closing this issue because I don't think / don't see how this can be "fixed" in m2e-code-quality - relying on Classpath ordering is almost always Very Bad Idea in Java? I suspect that this works "by chance" in CLI mvn..

@vorburger vorburger closed this Apr 19, 2016

odl-github pushed a commit to opendaylight/odlparent that referenced this issue Apr 21, 2016

Fix for improved Eclipse IDE setup: m2e Checkstyle ConversionException
This solves an Error that occurs in Eclipse with the Checkstyle Eclipse
plugin, where it gets confused between the REGEXP license for Checkstyle
and a default APL (not EPL) LICENSE.txt that is on the classpath of the
Checkstyle Maven plugin org.apache.commons.beanutils.ConversionException
line 83 in header specification is not a regular expression at
com.puppycrawl.tools.checkstyle.checks.header.RegexpHeaderCheck.postProcessHeaderLines(RegexpHeaderCheck.java:160)

m2e-code-quality/m2e-code-quality#83 has the
full background story and and further technical analysis details.

Change-Id: I34b286b23be195ff7bd2836d58faf983f5c5b500
Signed-off-by: Michael Vorburger <vorburger@redhat.com>

odl-github pushed a commit to opendaylight/releng-autorelease that referenced this issue Apr 21, 2016

Updated git submodules
Project: odlparent master e5484a910748612bee1096bc7fa4c792d14bf03b

Merge "Fix for improved Eclipse IDE setup: m2e Checkstyle ConversionException"

Fix for improved Eclipse IDE setup: m2e Checkstyle ConversionException

This solves an Error that occurs in Eclipse with the Checkstyle Eclipse
plugin, where it gets confused between the REGEXP license for Checkstyle
and a default APL (not EPL) LICENSE.txt that is on the classpath of the
Checkstyle Maven plugin org.apache.commons.beanutils.ConversionException
line 83 in header specification is not a regular expression at
com.puppycrawl.tools.checkstyle.checks.header.RegexpHeaderCheck.postProcessHeaderLines(RegexpHeaderCheck.java:160)

m2e-code-quality/m2e-code-quality#83 has the
full background story and and further technical analysis details.

Change-Id: I34b286b23be195ff7bd2836d58faf983f5c5b500
Signed-off-by: Michael Vorburger <vorburger@redhat.com>

mbooth101 pushed a commit to mbooth101/org.eclipse.cbi that referenced this issue Oct 17, 2017

Fix for improved Eclipse IDE setup: m2e Checkstyle ConversionException
This solves an Error that occurs in Eclipse with the Checkstyle Eclipse
plugin, where it gets confused between the REGEXP license for Checkstyle
and a default APL (not EPL) LICENSE.txt that is on the classpath of the
Checkstyle Maven plugin org.apache.commons.beanutils.ConversionException
line 83 in header specification is not a regular expression at
com.puppycrawl.tools.checkstyle.checks.header.RegexpHeaderCheck.postProcessHeaderLines(RegexpHeaderCheck.java:160)

m2e-code-quality/m2e-code-quality#83 has the
full background story and and further technical analysis details.

This commit is a port from https://git.opendaylight.org/gerrit/37842.

Change-Id: I4c0a9b962e42eab9df28909403efc70ad71d2308
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.