Configuring SuppressionFilter for Ant and Eclipse

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Configuring SuppressionFilter for Ant and Eclipse

Jeff Mutonho
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
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
Reply | Threaded
Open this post in threaded view
|

Re: Configuring SuppressionFilter for Ant and Eclipse

Oliver Burn
I used the following my configuration file:

  <module name="SuppressionFilter">
    <property
        name="file"
        value="${config_loc}/project-suppressions.xml"
        />
  </module>

The variable config_loc is expanded by the Eclipse plug-in to be the directory the configuration file lies in. See http://eclipse-cs.sourceforge.net/advanced_properties.html.

Under ANT and/or Maven I set the variable config_loc to the same directory.

Regards,
Oliver

On Thu, Dec 3, 2009 at 20:27, Jeff Mutonho <[hidden email]> wrote:
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
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev

_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user