I'm using custom checks, I followed the procedure described on the web link
you gave me. Everything now works correctly.
Maybe I'm wrong but I think there's a mistake in this documentation: in the
pom.xml example, dependencies containing custom developed checks are placed
in the <build> <extensions> ... </extensions> </build> section. But when I
run maven with my dependencies configured like that, these dependencies are
not placed on the classpath and maven can't resolve my custom developed
checks. If I place my dependencies containing custom developed checks in the
<plugin> <dependencies> ... </dependencies> </plugin> section, it works
fine.

On Fri, Jun 6, 2008 at 1:54 PM, Dennis Lundberg <[EMAIL PROTECTED]> wrote:

> Are you using your own custom checks or provide a custom packagenames.xml
> file? In that case see this page:
>
>
> http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html
>
>
> Julien Simon wrote:
>
>> Thanks for the answer. So, I tried maven-checkstyle-plugin 2.2 and it
>> didn't
>> work either, but that's a good beginning to have the correct plugin
>> version...
>> In the xml checkstyle configuration file where modules are defined, i
>> tried
>> to change
>> <module name="TreeWalker"> by <module
>> name="com.puppycrawl.tools.checkstyle.TreeWalker">and it now works. I
>> don't
>> really understand why we have to specify the fully qualified name of this
>> class, because it works fine when not using maven.
>>
>>
>>
>>
>> On Wed, Jun 4, 2008 at 11:47 PM, Dennis Lundberg <[EMAIL PROTECTED]>
>> wrote:
>>
>>  The Checkstyle plugin version 2.1 uses Checkstyle 4.1. So you can't use
>>> stuff from Checkstyle 4.3 in your Checkstyle configuration.
>>>
>>> Version 2.2 of the plugin, which is being released as we speak, uses
>>> Checkstyle 4.4. Start by giving that version a try.
>>>
>>>
>>> Julien Simon wrote:
>>>
>>>  Hi,
>>>> I'm trying  to integrate a checkstyle report in a maven project, but I'm
>>>> facing a problem. The checkstyle report is based on a custom checkstyle
>>>> check module I developed.
>>>> I'm using maven 2.0.9, maven-checkstyle-plugin 2.1, and checkstyle 4.3
>>>>
>>>> When I execute mvn checkstyle:checkstyle or mvn site, I get the
>>>> following
>>>> exception. I don't really understand why the TreeWalker can't be
>>>> instantiated.
>>>>
>>>> Any help would be great!
>>>>
>>>>
>>>>
>>>>
>>>> [ERROR] BUILD ERROR
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [INFO] An error has occurred in Checkstyle report generation.
>>>>
>>>> Embedded error: Failed during checkstyle configuration
>>>> Unable to instantiate TreeWalkerCheck
>>>> [INFO]
>>>> ------------------------------------------------------------------------
>>>> [DEBUG] Trace
>>>> org.apache.maven.lifecycle.LifecycleExecutionException: An error has
>>>> occurred in Checkstyle report generation.
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
>>>>   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
>>>>   at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
>>>>   at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
>>>>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>   at
>>>>
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
>>>>   at
>>>>
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>   at java.lang.reflect.Method.invoke(Method.java:615)
>>>>   at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>>>   at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>>>   at
>>>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>>>   at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>>>> Caused by: org.apache.maven.plugin.MojoExecutionException: An error has
>>>> occurred in Checkstyle report generation.
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:79)
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
>>>>   ... 16 more
>>>> Caused by: org.apache.maven.reporting.MavenReportException: Failed
>>>> during
>>>> checkstyle configuration
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:488)
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:98)
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:73)
>>>>   ... 18 more
>>>> Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException:
>>>> cannot
>>>> initialize module TreeWalker - Unable to instantiate TreeWalker
>>>>   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:723)
>>>>   at
>>>>
>>>>
>>>> org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:484)
>>>>   ... 20 more
>>>> Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException:
>>>> Unable
>>>> to instantiate TreeWalker
>>>>   at
>>>>
>>>>
>>>> com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:152)
>>>>   at
>>>> com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:140)
>>>>   ... 23 more
>>>> Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException:
>>>> Unable
>>>> to instantiate TreeWalkerCheck
>>>>   at
>>>>
>>>>
>>>> com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(PackageObjectFactory.java:94)
>>>>   at
>>>>
>>>>
>>>> com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:149)
>>>>   ... 24 more
>>>>
>>>>
>>>>  --
>>> Dennis Lundberg
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>
> --
> Dennis Lundberg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to