0

Hi tried to exclude folders from Jacoco code coverage in Azure Devops

azure-pipeline.yaml looks like below

i wanna exclude below paths

src/main/java/com/ing/investment/remoteadvice/*/model/**
src/main/java/com/ing/investment/remoteadvice/*/enums/** 

also tried adding -: com.ing.investment.remoteadvice.*.model.*. but did not work

could someone help me on this

potame
  • 7,597
  • 4
  • 26
  • 33
ramesh reddy
  • 429
  • 2
  • 5
  • 12
  • 1
    Hi ramesh, is there any update for this issue? The task doesn't support the behavior you want for now;, but you can post a feature request in [user voice forum](https://developercommunity.visualstudio.com/spaces/21/index.html) to share your feedback if you do want this feature. BTW, please check if my workaround can make some help~ – LoLance Jul 02 '20 at 02:47

1 Answers1

0

Need to exclude folders, or POM relative path from Jacoco code coverage in azure devops

As I know the Maven task doesn't support path-filter input. It only supports class-filter to include or exclude classes from collecting code coverage using codeCoverageClassFilter input.

You can check the inputs of the task here.

Workaround:

So assuming you have structure like:

src/main/java/com/ing/investment/remoteadvice/*/model/**
src/main/java/com/ing/investment/remoteadvice/*/enums/** 
src/main/java/com/ing/investment/remoteadvice/*/folderA/**
src/main/java/com/ing/investment/remoteadvice/*/folderB/**

We can't exclude model and enums folders, instead we can pass src/main/java/com/ing/investment/remoteadvice/*/folderA/**,src/main/java/com/ing/investment/remoteadvice/*/folderB/** to codeCoverageClassFilesDirectories input.

See description of codeCoverageClassFilesDirectories:

This field is required for a multi-module project. Specify a comma-separated list of relative paths from the Maven POM file to directories containing class files and archive files (JAR, WAR, etc.). Code coverage is reported for class files in these directories.

For example: target/classes,target/testClasses.
LoLance
  • 25,666
  • 1
  • 39
  • 73