Search code examples
eclipsecheckstyleoomph

How to configure Checkstyle setup with Oomph


I'm in the grips of automating our IDE setup with Oomph. I'm currently occupied with Checkstyle. Using the recorder function, no settings get saved when I set our company's own Checkstyle configuration. How do I solve this?


Solution

  • https://www.eclipse.org/forums/index.php/t/803782/:

    Add a Resource Creation task to your setup file, since Checkstyle saves its preferences in a dedicated file and not in the Oomph settings.

    E. g.:

    <setupTask
          xsi:type="setup:CompoundTask"
          id="checkstyle.prefs"
          disabled="false"
          name="Checkstyle Setup">
        <setupTask
            xsi:type="setup:ResourceCreationTask"
            excludedTriggers="BOOTSTRAP"
            filter=""
            content="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xA;&#xA;&lt;checkstyle-configurations file-format-version=&quot;5.0.0&quot; default-check-configuration=&quot;GOOS Checkstyle&quot;>&#xA;  &lt;check-configuration name=&quot;GOOS Checkstyle&quot; location=&quot;configuration\checkstyle\goos-checkstyle.xml&quot; type=&quot;external&quot; description=&quot;&quot;>&#xA;    &lt;additional-data name=&quot;protect-config-file&quot; value=&quot;true&quot;/>&#xA;  &lt;/check-configuration>&#xA;&lt;/checkstyle-configurations>&#xA;"
            targetURL="${workspace.location|uri}/.metadata/.plugins/net.sf.eclipsecs.core/checkstyle-config.xml"
            encoding="UTF-8">
          <description></description>
        </setupTask>
      </setupTask>
    

    The targetURL specifies the standard saving location for Checkstyle's preferences. This is also the place you can look for your own Checkstyle configuration, so you can add it to the content of the Oomph Resource Creation task.