sbt plugin

Martynas Mickevičius edited this page Apr 3, 2018 · 8 revisions
Clone this wiki locally

The sbt plugin is released for sbt version 0.13. To try it, do the following:

Add the following to your project/plugins.sbt file:

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.2.0")

Basic Usage

  1. Add the following to your build.sbt file:
mimaPreviousArtifacts := Set("com.jsuereth" % "scala-arm_2.9.1" % "1.2") // replace with your old artifact id
  1. Run mimaReportBinaryIssues. You should see something like the following:
[info] Found 4 potential binary incompatibilities
[error]  * method rollbackTransactionResource()resource.Resource in object resource.Resource does not have a   correspondent in new version
[error]  * method now()scala.util.continuations.ControlContext in trait resource.ManagedResourceOperations does not    have a correspondent in old version
[error]  * abstract method now()scala.util.continuations.ControlContext in interface resource.ManagedResource does not have a correspondent in old version
[error]  * method rollbackTransactionResource()resource.Resource in trait resource.MediumPriorityResourceImplicits does not have a correspondent in new version
[error] {file:/home/jsuereth/project/personal/scala-arm/}scala-arm/*:mima-report-binary-issues: Binary compatibility check failed!
[error] Total time: 15 s, completed May 18, 2012 11:32:29 AM

Advanced Usage (Filtering Binary Incompatibilities)

Sometimes you may want to filter out some binary incompatibility. For instance, because you warn your users to never use a class or method marked with a particular annotation (e.g., @experimental - note, this annotation is not part of the Scala standard library), you may want to exclude all classes/methods that use such annotation. In MiMa you can do this by explicitly list each binary incompatibility that you want to ignore (unfortunately, it doesn't yet support annotation-based filtering - PR is welcomed! :)).

Open your build.sbt file, and

  1. List the binary incompatibilities you would like to ignore
val ignoredABIProblems = {
  import com.typesafe.tools.mima.core._
  import com.typesafe.tools.mima.core.ProblemFilters._
  Seq(
    exclude[MissingClassProblem]("akka.dispatch.SharingMailbox"),
    exclude[IncompatibleMethTypeProblem]("akka.dispatch.DefaultPromise.<<")
  )
}
  1. Configure MiMa to include the defined binary incompatibility ignores
mimaPreviousArtifacts := Set("com.jsuereth" % "scala-arm_2.9.1" % "1.2") // replace with your old artifact id
mimaBinaryIssueFilters ++= ignoredABIProblems