Configuring SuppressionFilter for Ant and Eclipse

Jeff Mutonho <[email protected]> Thu, 3 Dec 2009 11:27:09 +0200
Newsgroups gmane.comp.java.audit.checkstyle.user
Message-ID <[email protected]>
Hi
I'm using Checkstyle both in my Ant build as well as a plugin in Eclipse.
My eclipse test project is called TestProject and has the following
directory structure:

C:/devenv/TestProject/
                               |-- src
                               |-- build
                               |-- checkstyle
                                                  `--
CheckstyleConventions5.0.xml
                                                   `-- Suppressions.xml



I've configured the Ant target as follows:


 <target name="checkstyle" depends="config, detect-os">
  <checkstyle config="${checkstyle.home}/CheckstyleConventions5.0.xml">
   <fileset dir="${locationName}/src" includes="**/*.java"/>

   <property key="checkstyle.suppressions.file"
value="${locationName}//checkstyle/Suppressions.xml"/>
    </checkstyle>
 </target>


and in the CheckstyleConventions5.0.xml the SuppressionFilter

 <module name="SuppressionFilter">
   <property name="file" value="${checkstyle.suppressions.file}"
default="C:/devenv/TestProject/checkstyle/Suppressions.xml"/>
 </module>


I  want to replace the path C:/devenv/checkstyle/Suppressions.xml"
with a variable that the checkstyle plugin can resolve at runtime,eg
the Eclipse project name.
I've tried   ${basedir}  and the checkstyle plugin bombs out with with
the following error message:

Errors during build.
  Errors running builder 'Checkstyle Builder' on project 'TestProject'.
  cannot initialize module SuppressionFilter - Cannot set property
'file' in module SuppressionFilter to
'${basedir}/checkstyle/Suppressions.xml': unable to find
${basedir}/checkstyle/Suppressions.xml
  cannot initialize module SuppressionFilter - Cannot set property
'file' in module SuppressionFilter to
'${basedir}/checkstyle/Suppressions.xml': unable to find
${basedir}/checkstyle/Suppressions.xml


Any  ideas how I can  configure this without using an absolute path,
default="C:/devenv/TestProject/checkstyle/Suppressions.xml" ?

Thanks,

Jeff

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev