aiyanbo / sbt-dependency-updates

⬆️ SBT plugin that can check Maven and Ivy repositories for dependency and plugin updates

GitHub

sbt-dependency-updates

Build Status Latest Version

Display your SBT project's dependency updates.

Dome

Installation

Add the following line to one of these files:

  • The project-specific file at project/plugins.sbt
  • Your global file at ~/.sbt/1.0/plugins/plugins.sbt for sbt 1.0
addSbtPlugin("org.jmotor.sbt" % "sbt-dependency-updates" % "1.2.0")

or ~/.sbt/0.13/plugins/plugins.sbt for sbt 0.13

addSbtPlugin("org.jmotor.sbt" % "sbt-dependency-updates" % "1.0.7")

Tasks

  • dependencyUpdates: show a list of project dependencies and plugins that can be updated
  • dependencyUpgrade: Experimental upgrade of project dependencies and plugins that can be updated

dependencyUpgrade

  • Add project/Dependencies.scala in your root project
  • Dependencies.scala as the following:
import sbt._

object Dependencies {

  // define versions, The variable name must be camel case by module name
  object Versions {
    val fansi = "0.2.5"
    val slf4j = "1.7.25"
    val guava = "24.0-jre"
    val scalatest = "3.0.5"
    val scala212 = "2.12.4"
    val scala211 = "2.11.11"
    val scalariform = "0.2.6"
    val scalaLogging = "3.7.2"
  }

  object Compile {
    val fansi = "com.lihaoyi" %% "fansi" % Versions.fansi
    val guava = "com.google.guava" % "guava" % Versions.guava
    val slf4jSimple = "org.slf4j" % "slf4j-simple" % Versions.slf4j
    val scalariform = "org.scalariform" %% "scalariform" % Versions.scalariform
  }

  object Test {
    val scalaTest: ModuleID = "org.scalatest" %% "scalatest" % Versions.scalatest % "test"
  }

  import Compile._

  lazy val dependencies = Seq(fansi, guava, slf4jSimple, scalariform, Test.scalaTest)

}

You can download an example project with this layout here:

Settings

  • dependencyUpgradeModuleNames: a setting to customize the mapping of module name

E.g. in build.sbt you can change configuration settings like this:

  dependencyUpgradeModuleNames := Map(
    "slf4j-simple" -> "slf4j",
    "undertow.*" -> "undertow"
  )
  • dependencyUpgradeComponentSorter: a setting to sort component names, default: org.jmotor.sbt.plugin.ComponentSorter.ByLength

org.jmotor.sbt.plugin.ComponentSorter.ByLength: sort the names by length org.jmotor.sbt.plugin.ComponentSorter.ByAlphabetically: sort the names by alphabetically

E.g. in build.sbt you can change configuration settings like this:

  import org.jmotor.sbt.plugin.ComponentSorter
  
  dependencyUpgradeComponentSorter := ComponentSorter.ByAlphabetically