Hi Lee,

As you said I thought something was missing in the
maven-checkstyle-plugin tutorial, so I checked the
following page:
http://checkstyle.sourceforge.net/config.html#Packages

It says "To specify other packages to apply, create a package names
XML document in a file named
checkstyle_packages.xml, and provide that file in the root of the .jar
containing your custom checks."

So I removed the property "packageNamesLocation" from pom.xml and
added checkstyle_packages.xml
file in the root of the .jar containing my custom check and it worked.

Thanks,
Makoto Sato



2011/3/28 Lee Meador <[email protected]>:
> Makoto,
>
> Perhaps the tutorial has something missing. Normally, you would put the .xml
> files in src/main/resources or add the bit to the POM that tells it to copy
> resources from src/main/java of type xml.
>
> You can tell if this is the problem by looking inside the jar that your are
> building with your custom checks in it. If the package names xml file is
> missing, this is the problem.
>
> Thanks.
>
> -- Lee
>
> On Sun, Mar 27, 2011 at 10:00 AM, Martin Gainty <[email protected]> wrote:
>
>>
>> so instead of 2 levels e.g:
>> FirstLevel
>>  SecondLevel
>>    java1.class
>>    java2.class
>>
>> you want 3 levels deep ??
>>
>> FirstLevel
>>  SecondLevel
>>   ThirdLevel
>>      java1.class
>>      java2.class
>>
>> Martin Gainty
>> ______________________________________________
>> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>
>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>> dient lediglich dem Austausch von Informationen und entfaltet keine
>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
>> destinataire prévu, nous te demandons avec bonté que pour satisfaire
>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>> de ceci est interdite. Ce message sert à l'information seulement et n'aura
>> pas n'importe quel effet légalement obligatoire. Étant donné que les email
>> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>> aucune responsabilité pour le contenu fourni.
>>
>>
>>
>>
>> > Date: Sun, 27 Mar 2011 11:31:26 +0200
>> > From: [email protected]
>> > To: [email protected]
>> > Subject: Re: Using Custom Developed Checkstyle Checks with
>> packagenames.xml
>> >
>> > On 2011-03-27 01:36, Makoto Sato wrote:
>> > > Hi,
>> > >
>> > > I'm using maven 3.0.2 and trying to follow the maven tutorial "Using
>> > > Custom Developed Checkstyle Checks"
>> > > (
>> http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html
>> ).
>> > >
>> > > It works with long module name(1) but doesn't work with short module
>> name(2):
>> > >
>> > > checkstyle.xml
>> > >
>> > > <?xml version="1.0"?><!DOCTYPE module PUBLIC
>> > >     "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
>> > >     "http://www.puppycrawl.com/dtds/configuration_1_2.dtd";>
>> > >
>> > > <module name="Checker">
>> > >   <module name="TreeWalker">
>> > >
>> > >     <!-- (1) It works. -->
>> > >     <module name="com.objectfanatics.checkstyle.checks.MethodLimit" />
>> > >
>> > >     <!-- (2) It doesn't work -->
>> > >     <module name="MethodLimit" />
>> > >
>> > >   </module>
>> > > </module>
>> > >
>> > > Does anyone has any idea?
>> >
>> > Does it work if you run Checkstyle from the command line (i.e. without
>> > using Maven) ?
>> >
>> > >
>> > > Regards,
>> > > Makoto Sato
>> > >
>> > > -------------------------
>> > > error message
>> > > -------------------------
>> > > [ERROR] Failed to execute goal
>> > > org.apache.maven.plugins:maven-site-plugin:3.0-beta-3:site
>> > > (default-site) on project mincheckstyleenv: Error during page
>> > > generation: Error rendering Maven report: Failed during checkstyle
>> > > configuration: cannot initialize module TreeWalker - Unable to
>> > > instantiate MethodLimit: Unable to instantiate MethodLimitCheck ->
>> > > [Help 1]
>> > >
>> > >
>> > > -------------------------
>> > > pom.xml
>> > > -------------------------
>> > >   ...
>> > > <plugin>
>> > >   <groupId>org.apache.maven.plugins</groupId>
>> > >   <artifactId>maven-checkstyle-plugin</artifactId>
>> > >   <version>2.6</version>
>> > >   <dependencies>
>> > >     <dependency>
>> > >       <groupId>com.objectfanatics.checkstyle</groupId>
>> > >       <artifactId>checks</artifactId>
>> > >       <version>0.0.1-SNAPSHOT</version>
>> > >     </dependency>
>> > >   </dependencies>
>> > > </plugin>
>> > > <plugin>
>> > >   <groupId>org.apache.maven.plugins</groupId>
>> > >   <artifactId>maven-site-plugin</artifactId>
>> > >   <version>3.0-beta-3</version>
>> > >   <configuration>
>> > >     <inputEncoding>UTF-8</inputEncoding>
>> > >     <outputEncoding>UTF-8</outputEncoding>
>> > >     <reportPlugins>
>> > >       <plugin>
>> > >         <groupId>org.apache.maven.plugins</groupId>
>> > >         <artifactId>maven-jxr-plugin</artifactId>
>> > >         <version>2.2</version>
>> > >         <configuration>
>> > >           <inputEncoding>UTF-8</inputEncoding>
>> > >           <outputEncoding>UTF-8</outputEncoding>
>> > >         </configuration>
>> > >       </plugin>
>> > >       <plugin>
>> > >         <groupId>org.apache.maven.plugins</groupId>
>> > >         <artifactId>maven-checkstyle-plugin</artifactId>
>> > >         <version>2.6</version>
>> > >         <configuration>
>> > >           <configLocation>checkstyle.xml</configLocation>
>> > >
>> <packageNamesLocation>com/objectfanatics/checkstyle/checks/packagenames.xml</packageNamesLocation>
>> > >         </configuration>
>> > >       </plugin>
>> > >     </reportPlugins>
>> > >   </configuration>
>> > > </plugin>
>> > >   ...
>> > >
>> > > -------------------------
>> > > checks-0.0.1-SNAPSHOT.jar
>> > > -------------------------
>> > >   - com
>> > >     - objectfanatics
>> > >       - checkstyle
>> > >         - checks
>> > >           - MethodLimitCheck.class
>> > >           - packagenames.xml
>> > >   - META-INF
>> > >     - MANIFEST.MF
>> > >     - maven
>> > >       - com.objectfanatics.checkstyle
>> > >         - checks
>> > >           - pom.properties
>> > >           - pom.xml
>> > >
>> > > -------------------------
>> > > packagenames.xml
>> > > -------------------------
>> > > <?xml version="1.0" encoding="UTF-8"?>
>> > >
>> > > <!DOCTYPE checkstyle-packages PUBLIC
>> > >     "-//Puppy Crawl//DTD Package Names 1.0//EN"
>> > >     "http://www.puppycrawl.com/dtds/packages_1_0.dtd";>
>> > >
>> > > <checkstyle-packages>
>> > >   <package name="com.objectfanatics.checkstyle.checks" />
>> > >   <package name="com.puppycrawl.tools.checkstyle">
>> > >     <package name="checks">
>> > >       <package name="annotation" />
>> > >       <package name="blocks" />
>> > >       <package name="coding" />
>> > >       <package name="design" />
>> > >       <package name="duplicates" />
>> > >       <package name="header" />
>> > >       <package name="imports" />
>> > >       <package name="indentation" />
>> > >       <package name="javadoc" />
>> > >       <package name="metrics" />
>> > >       <package name="modifier" />
>> > >       <package name="naming" />
>> > >       <package name="regexp" />
>> > >       <package name="sizes" />
>> > >       <package name="whitespace" />
>> > >     </package>
>> > >     <package name="filters" />
>> > >   </package>
>> > > </checkstyle-packages>
>> > >
>> > > ---------------------------------------------------------------------
>> > > 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]
>> >
>>
>>
>
>
>
> --
> -- Lee Meador
> Sent from gmail. My real email address is lee AT leemeador.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to