Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excludes not working #117

Open
HugoTigre opened this issue Nov 7, 2018 · 12 comments
Open

excludes not working #117

HugoTigre opened this issue Nov 7, 2018 · 12 comments

Comments

@HugoTigre
Copy link

Expected vs Actual Behaviour

I have a Method code too large! error, in a class the java runs fine. For now I don't want to change the class so I want to exclude it from instrumentation, but this is not working.

I tried several approaches in sbt, but none is working, for example

lazy val jacoco = Seq(
  jacocoReportSettings in Test := JacocoReportSettings()
    .withFileEncoding("UTF-8")
    .withFormats(JacocoReportFormats.XML),
  jacocoExcludes in Test := Seq(
    "**/*NameOfClass.*"
  )
)

then adding jacoco to project settings.

also:

jacocoExcludes in Test := Seq(
  "**/*NameOfClass.*"
)

Tried several combinations of the class to exclude, but none work. I still get the error.

It should...
Exclude class from instrumentation.

Instead it...
Includes all classes

Steps to Reproduce

> sbt jacoco

Environment

  • SBT version: 0.13.11
  • Plugin version: 3.1.0
  • Scala version(s): 2.11.7
  • Java version: 8
@fabianedl777
Copy link

any progress for this issue?

@daemonsoft
Copy link

also I have this problem

. SBT version: 1.2.3
. Plugin version: 3.1.0
. Scala version(s): 2.12.2
. Java version: 8

@jpoh97
Copy link

jpoh97 commented Apr 4, 2019

Any news?

@master-elodin
Copy link

master-elodin commented Jul 11, 2019

This configuration is working for me to exclude ServiceFoo and ServiceBar; maybe it will work for you too?

jacocoExcludes := Seq(
  "com.something.services.ServiceFoo",
  "com.something.services.ServiceBar"
)

@jonathanandrade10
Copy link

jonathanandrade10 commented Nov 5, 2020

This configuration is working for me to exclude ServiceFoo and ServiceBar; maybe it will work for you too?

jacocoExcludes := Seq(
  "com.something.services.ServiceFoo",
  "com.something.services.ServiceBar"
)

For me it's not working and I'm on 3.1.0.
which version worked for you master-elodin ?

@ca7erina
Copy link

ca7erina commented Nov 10, 2020

I have tried to add the below code to my "build.sbt" (3.1.0), it did exclude it at the code coverage percentage. However, the file is still instrumented.
jacocoExcludes := Seq("org.scalasbt.jacoco.example.Greeter")

I still get the instrumentation error about "method too large", the error comes at the instrumenting stage, so how to exclude files from instrumentation?

@muncleben
Copy link

It does not work for me. I'm using 3.4.0

@Montagon
Copy link

Montagon commented Nov 2, 2022

Hi all,

In my case, it worked using the same approach as in issue #96. It was adding .* to the class ref. For example:

jacocoExcludes := Seq(
  "com.test.base.model.TestModel.*"
)

Hope it works for you.

@dexterhu
Copy link

I had similar issues. The root cause turned out to be how to apply that setting. I directly put inside settings block, which worked for me. No need to define jacoco

@sushi30
Copy link

sushi30 commented Jun 27, 2023

I followed the suggestion by @Montagon and it worked like charm on 3.4.0.

Hi all,

In my case, it worked adding using the same approach that in issue #96. It was adding .* to the class ref. For example:

jacocoExcludes := Seq(
  "com.test.base.model.TestModel.*"
)

Hope it works for you.

@alonshoshani
Copy link

@dexterhu can you please provide an example?

@dexterhu
Copy link

dexterhu commented Aug 3, 2023

hi @alonshoshani, below worked for me in my build.sbt

lazy val settings = Seq(
  //...
  jacocoInstrumentationExcludes := Seq(
    "com.example.com.ABC*"
  )
 //...
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests