[ 
https://jira.codehaus.org/browse/MCHECKSTYLE-228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Hawkes-Lewis updated MCHECKSTYLE-228:
----------------------------------------------

    Description: 
Checkstyle allows the definition of a list of files and their line ranges that 
should be suppressed using 
[SuppressionFilter|http://checkstyle.sourceforge.net/config.html#SuppressionFilter].

SuppressionFilter allows you to specify a default suppressions file, for 
example:

{code}
<module name="SuppressionFilter">
    <property name="file" value="${some.property}" 
default="my-default-suppressions.xml" />
</module>
{code}

Checkstyle Maven plugin allows you to pass through a file to set 
{{${some.property}}}:

http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/suppressions-filter.html

Checkstyle Maven plugin also allows you to depend on artefacts, such as a 
shared artefact containing Checkstyle check classes or a Checkstyle 
configuration XML file:

http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html

If you reference this configuration XML file in {{configLocation}}, it will be 
successfully found.

But if you do not explicitly set the suppressions file property, expecting it 
to fall back to a default suppressions file in the same shared artefact, the 
plugin fails to set the classpath/classloader such that Checkstyle's 
{{SuppressionsLoader}} can load the suppressions file, resulting in errors like:

{code}
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-checkstyle-plugin:2.12.1:check (default-cli) on 
project checked-module: Failed during checkstyle configuration: cannot 
initialize module SuppressionFilter - Cannot set property 'file' in module 
SuppressionFilter to 'suppressions.xml': unable to find suppressions.xml: 
InvocationTargetException -> [Help 1]
{code}

See also discussion of this issue over in the Checkstyle project:

https://github.com/checkstyle/checkstyle/issues/62

I've attempted to create a minimal test case that demonstrates the problem over 
at:

https://github.com/benjaminhawkeslewis/maven-checkstyle-plugin-default-suppressions-lookup-bug

Backstory: The reason why I want to put a suppressions file inside my shared 
checkstyle configuration artefact is to allow projects using my shared 
configuration to (optionally) include a suppressions XML file specifying 
exemptions. I couldn't find a way to make this optional, without providing a 
default (blank) suppressions file.



  was:
Checkstyle allows the definition of a list of files and their line ranges that 
should be suppressed using 
[SuppressionFilter|http://checkstyle.sourceforge.net/config.html#SuppressionFilter].

SuppressionFilter allows you to specify a default suppressions file, for 
example:

{code}
<module name="SuppressionFilter">
    <property name="file" value="${some.property}" 
default="my-default-suppressions.xml" />
</module>
{code}

Checkstyle Maven plugin allows you to depend on artefacts, such as a shared 
artefact containing your Checkstyle configuration XML:

http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html

If you specify this configuration XML file in {{configLocation}}, it is found, 
but the default suppressions XML file referenced in turn is not looked up using 
the same classloader/classpath and subsequently is not found, resulting in 
error like:

{code}
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-checkstyle-plugin:2.12.1:check (default-cli) on 
project checked-module: Failed during checkstyle configuration: cannot 
initialize module SuppressionFilter - Cannot set property 'file' in module 
SuppressionFilter to 'suppressions.xml': unable to find suppressions.xml: 
InvocationTargetException -> [Help 1]
{code}

See also discussion of this issue over in the Checkstyle project:

https://github.com/checkstyle/checkstyle/issues/62

I've attempted to create a minimal test case that demonstrates the problem over 
at:

https://github.com/benjaminhawkeslewis/maven-checkstyle-plugin-default-suppressions-lookup-bug

Backstory: The reason why I want to put a suppressions file inside my shared 
checkstyle configuration artefact is to allow projects using my shared 
configuration to (optionally) include a suppressions XML file specifying 
exemptions. I couldn't find a way to make this optional, without providing a 
default (blank) suppressions file.




> Default suppressions file lookup from a Checkstyle configuration in a shared 
> artefact fails
> -------------------------------------------------------------------------------------------
>
>                 Key: MCHECKSTYLE-228
>                 URL: https://jira.codehaus.org/browse/MCHECKSTYLE-228
>             Project: Maven Checkstyle Plugin
>          Issue Type: Bug
>            Reporter: Benjamin Hawkes-Lewis
>            Priority: Minor
>
> Checkstyle allows the definition of a list of files and their line ranges 
> that should be suppressed using 
> [SuppressionFilter|http://checkstyle.sourceforge.net/config.html#SuppressionFilter].
> SuppressionFilter allows you to specify a default suppressions file, for 
> example:
> {code}
> <module name="SuppressionFilter">
>     <property name="file" value="${some.property}" 
> default="my-default-suppressions.xml" />
> </module>
> {code}
> Checkstyle Maven plugin allows you to pass through a file to set 
> {{${some.property}}}:
> http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/suppressions-filter.html
> Checkstyle Maven plugin also allows you to depend on artefacts, such as a 
> shared artefact containing Checkstyle check classes or a Checkstyle 
> configuration XML file:
> http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html
> If you reference this configuration XML file in {{configLocation}}, it will 
> be successfully found.
> But if you do not explicitly set the suppressions file property, expecting it 
> to fall back to a default suppressions file in the same shared artefact, the 
> plugin fails to set the classpath/classloader such that Checkstyle's 
> {{SuppressionsLoader}} can load the suppressions file, resulting in errors 
> like:
> {code}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-checkstyle-plugin:2.12.1:check (default-cli) 
> on project checked-module: Failed during checkstyle configuration: cannot 
> initialize module SuppressionFilter - Cannot set property 'file' in module 
> SuppressionFilter to 'suppressions.xml': unable to find suppressions.xml: 
> InvocationTargetException -> [Help 1]
> {code}
> See also discussion of this issue over in the Checkstyle project:
> https://github.com/checkstyle/checkstyle/issues/62
> I've attempted to create a minimal test case that demonstrates the problem 
> over at:
> https://github.com/benjaminhawkeslewis/maven-checkstyle-plugin-default-suppressions-lookup-bug
> Backstory: The reason why I want to put a suppressions file inside my shared 
> checkstyle configuration artefact is to allow projects using my shared 
> configuration to (optionally) include a suppressions XML file specifying 
> exemptions. I couldn't find a way to make this optional, without providing a 
> default (blank) suppressions file.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to