Re: ANT - Checkstyle with custom check
Bhavana <[email protected]>
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <[email protected]> |
I had a similar issue for some time. The target would work only on my machine. I had to fix and try out some of the following to get my target to work: Adding the custom checkstyle jar to java's extensions java\lib\ext Using ant 1.7 Making sure there isn't some other jar for checkstyle library being used from some other location Thanks Bhavana On Thu, Sep 4, 2008 at 8:22 AM, Thomas Suckow <[email protected]> wrote: > I started using checkstyle with ant about a week ago. It went smooth. > Trying to add custom checks is kicking my butt. > > I have a check TabOnlyForIndent extends Check > in package org.hopto.defcon1.checks; > I packaged as a jar from eclipse, it has an empty manifest (besides > version). > > in ant i load checkstyle and put my jar in the classpath: > <taskdef resource="checkstyletask.properties"> > <classpath> > <pathelement > location="lib/checkstyle-5.0-beta01/checkstyle-all-5.0-beta01.jar"/> > <pathelement location="lib/Defcon1Checks.jar"/> > </classpath> > </taskdef> > > I add my check to the config > > <!-- <module name="TabCharacter"/> Viva La \t --> > <module name="org.hopto.defcon1.checks.TabOnlyForIndent"/> > <module name="WhitespaceAfter"/> > > Have my checkstyle target in ant > > <target name="checkstyle" depends="compile" > description="Checks that we are using consistant well formed style."> > <checkstyle config="config_checkstyle.xml" failOnViolation="false"> > <fileset dir="src" includes="**/*.java"/> > <formatter type="xml" toFile="checkstyle-result.xml"/> > </checkstyle> > </target> > > And kaboom: > Unable to create a Checker: cannot initialize module TreeWalker - > Unable to instantiate org.hopto.defcon1.checks.TabOnlyForIndent > > I've tried compiling my check under java 6 and specifying target 1.4 > Tryed various ways of including in classpath > > Ideas, Thoughts, Recommendations? > > Thomas Suckow > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Checkstyle-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/checkstyle-user > -- Bhavana Rehani ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Checkstyle-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/checkstyle-user