Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1170

CloverOptimizerMojo does not support full include/exclude syntax

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 3.1.10
    • 3.1.7
    • Maven plugin
    • None

    Description

      Problem:

      CloverOptimizerMojo does not support full include/exclude syntax, which can be handled by maven-surefire-plugin. Two cases are not handled right now:

      (1) multiple paths separated by comma

      <include>**/Test1.java, **/Test2.java</include>
      

      (2) regular expression instead of Ant-style pattern

      <include>%regex[.*Test.class]</include>
      

      See: http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html

      Workaround:

      (1) use separate entries, like:

      <include>**/Test1.java</include>
      <include>**/Test2.java</include>
      

      (2) not available; user can try to replace regexp by set of Ant-style patterns

      Implementation:

      CloverOptimizerMojo relies an Ant-style patterns underneath. The CloverOptimizerMojo.createFileSet() method has

      private FileSet createFileSet(Project antProject, final File directory, List includes, List excludes) {
        FileSet testFileSet = new FileSet();
        ...
        testFileSet.appendIncludes((String[]) includes.toArray(new String[includes.size()]));
      }
      

      fix for (1) - split every element in includes/excludes arrays using the comma delimiter and pass expanded arrays to appendIncludes()

      fix for (2) - find all elements from includes/excludes arrays having %regexp keyword, run file search on directory using a filename matcher with regexp, create include/exclude for every file matched

      Attachments

        Activity

          People

            mparfianowicz Marek Parfianowicz
            mparfianowicz Marek Parfianowicz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: