Re: ANT - Checkstyle with custom check
"Thomas Suckow" <[email protected]>
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <[email protected]> |
Well I removed the one in the classpath. This would explain why i had problems in command line. Now however I get the error: Unable to create a Checker: cannot initialize module PackageHtml - Unable to instantiate PackageHtml Thomas Suckow On Thu, Sep 4, 2008 at 4:29 PM, Oliver Burn <[email protected]> wrote: > This is the "classic" classpath issue. Be sure that you do not have > Checkstyle anywhere else in your classpath. Look in $ANT_HOME/lib. > > Also test using the declaration: > > <taskdef resource="checkstyletask.properties"> > <classpath> > <pathelement location="lib/Defcon1Checks.jar"/> > </classpath> > </taskdef> > > If this gives the same results, it means that you have another version of > Checkstyle in your classpath. > > Running ANT with the "-debug" flag can show where it is being found. > > On Fri, Sep 5, 2008 at 01:32, Bhavana <[email protected]> wrote: >> >> 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 >> > > > ------------------------------------------------------------------------- > 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 > > ------------------------------------------------------------------------- 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=/