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

JacocoItPlugin not working #110

Open
adrianprecub opened this issue Mar 22, 2018 · 4 comments
Open

JacocoItPlugin not working #110

adrianprecub opened this issue Mar 22, 2018 · 4 comments

Comments

@adrianprecub
Copy link

Expected vs Actual Behaviour

Run jacoco for integration tests

Instead throws an error when i enable JacocoItPlugin.

Steps to Reproduce

I removed the below lines from my build.sbt

configs(IntegrationTest)
Defaults.itSettings

And enabled plugin JacocoItPlugin along with the playjava plugin: enablePlugins(PlayJava, JacocoItPlugin)
I also have these settings in my jacoco.sbt file:

jacocoReportDirectory := file(target.value + "/reports/jacoco")
jacocoReportSettings in Test := JacocoReportSettings()
  .withTitle("Jacoco Unit Tests Coverage Report")
  .withFileEncoding("UTF-8")
  .withFormats(JacocoReportFormats.ScalaHTML, JacocoReportFormats.XML)

jacocoReportSettings in IntegrationTest := JacocoReportSettings()
  .withTitle("Jacoco Integration Tests Coverage Report")
  .withFileEncoding("UTF-8")
  .withFormats(JacocoReportFormats.ScalaHTML, JacocoReportFormats.XML)

When i try to run

>sbt it:jacoco

i get the following error:
java.lang.IllegalArgumentException: Cannot add dependency 'org.jacoco#org.jacoco.agent;0.7.9' to configuration 'it' of module MyModule;1.9.0-SNAPSHOT because this configuration doesn't exist! at org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor.addDependencyConfiguration(DefaultDependencyDescriptor.java:565) at org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser$AbstractParser.parseDepsConfs(AbstractModuleDescriptorParser.java:157) at org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser$AbstractParser.parseDepsConfs(AbstractModuleDescriptorParser.java:128) at org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser$AbstractParser.parseDepsConfs(AbstractModuleDescriptorParser.java:118) at org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser$AbstractParser.parseDepsConfs(AbstractModuleDescriptorParser.java:113) at sbt.CustomXmlParser$CustomParser.parseDepsConfs(CustomXmlParser.scala:32) at sbt.IvySbt$.convertDependency(Ivy.scala:615) at sbt.IvySbt$$anonfun$9.apply(Ivy.scala:564) at sbt.IvySbt$$anonfun$9.apply(Ivy.scala:564) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.immutable.List.foreach(List.scala:318) at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) at scala.collection.AbstractTraversable.map(Traversable.scala:105) at sbt.IvySbt$.addDependencies(Ivy.scala:564) at sbt.IvySbt$Module.configureInline(Ivy.scala:194) at sbt.IvySbt$Module.x$6$lzycompute(Ivy.scala:172) at sbt.IvySbt$Module.x$6(Ivy.scala:167) at sbt.IvySbt$Module.sbt$IvySbt$Module$$moduleDescriptor0$lzycompute(Ivy.scala:167) at sbt.IvySbt$Module.sbt$IvySbt$Module$$moduleDescriptor0(Ivy.scala:167) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156) at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:156) at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:133) at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57) at sbt.IvySbt$$anon$4.call(Ivy.scala:65) at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95) at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80) at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99) at xsbt.boot.Using$.withResource(Using.scala:10) at xsbt.boot.Using$.apply(Using.scala:9) at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60) at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50) at xsbt.boot.Locks$.apply0(Locks.scala:31) at xsbt.boot.Locks$.apply(Locks.scala:28) at sbt.IvySbt.withDefaultLogger(Ivy.scala:65) at sbt.IvySbt.withIvy(Ivy.scala:128) at sbt.IvySbt.withIvy(Ivy.scala:125) at sbt.IvySbt$Module.withModule(Ivy.scala:156) at sbt.IvyActions$.updateEither(IvyActions.scala:168) at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1442) at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1438) at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$90.apply(Defaults.scala:1473) at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$90.apply(Defaults.scala:1471) at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37) at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1476) at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1470) at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60) at sbt.Classpaths$.cachedUpdate(Defaults.scala:1493) at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1420) at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1372) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40) at sbt.std.Transform$$anon$4.work(System.scala:63) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17) at sbt.Execute.work(Execute.scala:237) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159) at sbt.CompletionService$$anon$2.call(CompletionService.scala:28) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)

If i remove the JacocoItPlugin, i can run jacoco for unit tests and i get the coverage.

Environment

  • SBT version: 0.13
  • Plugin version: 3.0.3
  • Scala version(s): 2.11.8
  • Java version: 1.8.0_131
  • Link to project source: N/A
@aok-solutions
Copy link

Try adding those values back to your build.sbt and see what happens. That's what worked for me.

configs(IntegrationTest)
Defaults.itSettings

@rania-chantz
Copy link

That fixed it for me too, thanks! The documentation is a bit misleading
https://github.com/sbt/sbt-jacoco/wiki/Migrating-from-2.x-to-3.x#changes-to-plugin-loading

@gokhanoner
Copy link

@rania-globalorange can you share your build.sbt & jacoco.sbt files, at least related sections. I'm trying to do the same & getting the exact same error :(

@rania-chantz
Copy link

@gokhanoner Sorry it took a while, this is what I have

lazy val root = (project in file("."))
.enablePlugins(JacocoItPlugin)
.configs(IntegrationTest)
.settings(inConfig(IntegrationTest)(Defaults.itSettings): _*)

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

4 participants