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

mimaReportBinaryIssues on a POM-only module results in java.lang.RuntimeException: not a directory or jar file #702

Closed
DavidGregory084 opened this issue Jun 14, 2022 · 1 comment

Comments

@DavidGregory084
Copy link

Spotted in typelevel/typelevel-scalafix#18:

[error] java.lang.RuntimeException: not a directory or jar file: /home/runner/work/typelevel-scalafix/typelevel-scalafix/target/rules-aggregate/target/scala-2.13/classes
[error] 	at scala.sys.package$.error(package.scala:30)
[error] 	at com.typesafe.tools.mima.lib.MiMaLib.$anonfun$createPackage$1(MiMaLib.scala:13)
[error] 	at scala.Option.getOrElse(Option.scala:189)
[error] 	at com.typesafe.tools.mima.lib.MiMaLib.createPackage(MiMaLib.scala:13)
[error] 	at com.typesafe.tools.mima.lib.MiMaLib.collectProblems(MiMaLib.scala:34)
[error] 	at com.typesafe.tools.mima.plugin.SbtMima$.checkBC$1(SbtMima.scala:24)
[error] 	at com.typesafe.tools.mima.plugin.SbtMima$.runMima(SbtMima.scala:27)
[error] 	at com.typesafe.tools.mima.plugin.MimaPlugin$.$anonfun$binaryIssuesFinder$5(MimaPlugin.scala:99)
[error] 	at scala.collection.Iterator$$anon$10.next(Iterator.scala:461)
[error] 	at scala.collection.Iterator.foreach(Iterator.scala:943)
[error] 	at scala.collection.Iterator.foreach$(Iterator.scala:943)
[error] 	at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
[error] 	at com.typesafe.tools.mima.plugin.MimaPlugin$.$anonfun$projectSettings$1(MimaPlugin.scala:26)
[error] 	at com.typesafe.tools.mima.plugin.MimaPlugin$.$anonfun$projectSettings$1$adapted(MimaPlugin.scala:25)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] 	at sbt.Execute.work(Execute.scala:291)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:750)
[error] (typelevel-scalafix-rules / mimaReportBinaryIssues) not a directory or jar file: /home/runner/work/typelevel-scalafix/typelevel-scalafix/target/rules-aggregate/target/scala-2.13/classes

I think the problem is that we are trying to execute mimaReportBinaryIssues on an empty module. That module only exists to publish a pom file that depends on other modules in the project.

The module is defined like so:

lazy val `typelevel-scalafix-rules` = project
  .in(file("target/rules-aggregate"))
  .dependsOn(catsRules, catsEffectRules)
  .settings(
    moduleName := "typelevel-scalafix",
    tlVersionIntroduced ++= List("2.12", "2.13").map(_ -> "0.1.2").toMap
  )

I'm not exactly sure if this is the correct way to declare a module for this purpose but I guess MiMa should probably fail slightly more gracefully.

@armanbilge
Copy link
Contributor

armanbilge commented Jun 14, 2022

IMHO it seems reasonable if there are no class files available to proceed normally. After all, if MiMa compares them to previous artifacts and finds there are classes in them, then it will raise the usual errors.

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

No branches or pull requests

3 participants