Skip to content

Can maven plugin get the 'excludes' property from CMD property #577

@baifan

Description

@baifan

Out test suit will scan several project, but these projects do not declare jacoco plugin in their poms.
We want to exclude some diff class in diff project.
Can jacoco get the 'excludes' property from CMD property?

Like this

/**
 * A list of class files to exclude from report, separated by commas.
 * They will add to {@link #excludes} attribute.
 */
@Parameter(property = "jacoco.excludes")
private String excludesString;

/**
 * A list of class files to exclude from the report. May use wildcard
 * characters (* and ?). When not specified nothing will be excluded.
 */
@Parameter
List<String> excludes;

@Override
public void execute() throws MojoExecutionException {
  ...           
    if (excludesString != null && excludesString.trim().length() > 0 ){
      if (excludes == null){
        excludes = new ArrayList<String>();
      }
      String[] excludeTokens = excludesString.split(";");
      for (String excludeToken : excludeTokens) {
        excludes.add(excludeToken);
      }
    }
  ...
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions