In our multi-project codebase, we are using Maven as build framework.
However, we have a Play framework based module, for which we have to use SBT build.
In Maven projects, we have dependencyManagement configured through another project called "version" and included 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 makes sure to pull correct version of dependency jars for the specific build.
Is there a way to achieve same with SBT?
Background. update resolves dependencies according to the settings in a build file, such as libraryDependencies and resolvers . Other tasks use the output of update (an UpdateReport ) to form various classpaths. Tasks that in turn use these classpaths, such as compile or run , thus indirectly depend on update .
sbt (through Ivy) verifies the checksums of downloaded files by default. It also publishes checksums of artifacts by default. The checksums to use are specified by the checksums setting.
The best alternative is GNU Make, which is both free and Open Source. Other great apps like Maven are CMake, Gradle, SCons and Meson. Apache Maven is a Java-based tool for build automation and project management (in software development).
The “provided” keyword indicates that the dependency is provided by the runtime, so there's no need to include it in the JAR file. When using sbt-assembly, we may encounter an error caused by the default deduplicate merge strategy. In most cases, this is caused by files in the META-INF directory.
You can create an in-house sbt plugin that defines something like the follows:
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
}
After adding the plugin to your Play app, you can write inside build.sbt
as follows:
import com.example.Dependencies._
and akkaActor
will be available as a name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With