SBT alternative for maven dependencyManagement

In our multi-project codebase, we use Maven as the basis for building.
However, we have a module based on the Play platform, for which we must use SBT build.

In Maven projects, we manage dependencyManagement with another project called "version" and include it in pom.xml as follows.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.xxxx.release</groupId>
            <artifactId>xxxx-version</artifactId>
            <version>${project.version}</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

This provides the correct version of dependency cans for a particular assembly.

Is there a way to achieve the same with SBT?

+6
source share
1 answer

You can create your own sbt plugin that defines something like the following:

package com.example

import sbt._

object Dependencies {
  // versions
  lazy val akkaVersion = "2.5.22"

  // libraries
  val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion
  val akkaCluster = "com.typesafe.akka" %% "akka-cluster" % akkaVersion
}

Play build.sbt :

import com.example.Dependencies._

akkaActor .

0

Source: https://habr.com/ru/post/1652169/


All Articles