Skip to Content
author's profile photo Former Member
Former Member

Hybris configurations for Checkstyle and Findbugs


I'm trying to configure Checkstyle, PMD, and Findbugs for my current project. PMD comes with hybris out of the box so that is taken care of. Hybris has installation instructions for all of these tools on the wiki but fails to provide the ruleset configurations they use. Does anyone know where I can get a copy of the checkstyle and findbug rulesets used by Hybris?

Thanks, John

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on May 07, 2015 at 10:43 PM

    I managed to get it working by specifying a custom ANT build.xml file. I attached a copy that you can use as a reference. The file is located in a dummy extension which also includes a "lib" folder where all of ANT plugin files are located as well as a "docs" folder which include the coding rules. I've included tasks for Checkstyle, Findbugs and CPD. We are using the default PMD task that comes with hybris.

    These tasks are not integrated with the base hybris build system so in my local environment, I'm executing the tasks manually at the command line. However, I have integrated the tasks in our Jenkins build system so they are executed on every text (1.6 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 07, 2016 at 10:49 PM

    This is what I did to get it working with the normal SAP Hybris build process (update paths to meet your needs):

    1. Pick an extension to update the buildcallbacks.xml

    2. Create a dir that has the checkstyle jar file, checkstyle-simple.xsl,, hybris-checks.xml

    3. Add the following:


     <path id="tools.classpath">
        <fileset dir="${utils.dir}">
         <include name="cobertura/cobertura*.jar" />
         <include name="lib/**/*.jar" />
     <taskdef classpathref="tools.classpath" resource="com/puppycrawl/tools/checkstyle/ant/"/>
     <fileset id="source.files" dir="${hybris.custom.dir}">
             <include name="<extensionName>/**/src/**/*.java" />
         <!-- Exclude specific Accelerator classes -->
         <exclude name="**/src/**/*" />
             <exclude name="**/src/**/cmscockpit/**/*.java" />
         <exclude name="**/src/**/filters/**/*.java" />
         <exclude name="**/src/**/jalo/**/*.java" />
         <exclude name="**/src/**/*" />
         <!-- Exclude generated source files and test classes -->
         <exclude name="**/gensrc/**/*.java" />
         <exclude name="**/testsrc/**/*.java" />
         <macrodef name="<extension_name>_after_build">
                 <mkdir dir="${utils.dir}/checkstyle/dist/reports/checkstyle" />
             <checkstyle config="${utils.dir}/checkstyle/hybris-checks.xml" failureproperty="checkstyle.failure" failonviolation="false" maxWarnings="1000">
                 <formatter type="plain" />
                 <formatter type="xml" tofile="${utils.dir}/checkstyle/dist/reports/checkstyle/checkstyle.xml" />
                 <fileset refid="source.files" />
             <xslt in="${utils.dir}/checkstyle/dist/reports/checkstyle/checkstyle.xml" style="${utils.dir}/checkstyle/checkstyle-simple.xsl" out="${utils.dir}/checkstyle/dist/reports/checkstyle/report.html" />
             <fail message="Checkstyle failed : ${checkstyle.failure}" if="checkstyle.failure" />

    After the build you will find your reports (xml & html) in the dist/reports/checkstyle/ directory

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 29, 2015 at 03:38 PM

    Did you ever get a response on this? I'm also trying to configure Checkstyle and Findbugs using ANT. Any information you can provide would be greatly appreciated.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I never got a reply. I emailed hybris support and they kept pointing me to wiki pages for these technologies that don't contain the rulesets. I kept asking to talk to someone technical and they said they aren't allowed to connect me with a developer.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.