Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Checkstyle Additional Property checkstyle.header.file points to wrong LICENSE.txt #83
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:
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.
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.
#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..