Funny how things in the universe sometimes occur at the exact same time...
Yesterday I completely rewrote the example about using custom checks for
the Checkstyle plugin. It is now a complete example with all code
necessary. It's not published yet, but you can (sort of) read it
directly from svn [1] or you can check out the Checkstyle plugin and run
'mvn site' to build the docs yourself.
[1]
https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-checkstyle-plugin/src/site/apt/examples/custom-developed-checkstyle.apt
Barrie Treloar wrote:
On Sep 11, 2007 11:38 PM, Michael Fortin <[EMAIL PROTECTED]> wrote:
Hello.
I've been trying to get a custom check installed and can't get it run.
I've followed the directions from the maven site almost to the letter
but it keeps failing on the packagenames.xml. If I take my custom check
out of the checkstyle.xml it still fails but on another check. It seems
to find the file packagenames.xml but not load it. CLI output and files
are below. Any help would be greatly appreciated.
Did you solve this?
I was having similar issues.
maven file:
...
<build>
<extensions>
<extension>
<groupId>com.monetizeit</groupId>
<artifactId>checkstyle</artifactId>
<version>1.0-SNAPSHOT</version>
</extension>
</extensions>
Delete the extesions since it is not needed (I couldn't even get it to
work), use a dependency in the build/plugins sections:
e.g checkstyle:checkstyle-patch-1882332:4.3 contains my custom check.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<dependencies>
<dependency>
<groupId>checkstyle</groupId>
<artifactId>checkstyle-patch-1882332</artifactId>
<version>4.3</version>
</dependency>
</dependencies>
...
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>src/main/config/checkstyle.xml</configLocation>
<packageNamesLocation>src/main/config/checkstyle-packages.xml</packageNamesLocation>
</configuration>
</plugin>
</plugins>
</reporting>
Your reporting section is fine, but you may want to consider
referencing a packagenames file which you bundle in with your custom
check.
Then you can remove the need to fully qualify your check in the checkstyle.xml
e.g
<module name="com.monetizeit.checkstyle.BlanklineCheck" />
can become
<module name="BlanklineCheck" />
Once you put in
<package name="com.monetizeit.checkstyle"/>
into your packagenames.xml file.
---------------------------------------------------------------------
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]