Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sbt/sbt/llms.txt

Use this file to discover all available pages before exploring further.

The IvyPlugin enables dependency resolution and artifact publishing using Apache Ivy. It provides core tasks for updating dependencies, creating POM files, and publishing to repositories. This plugin is automatically enabled on all projects.

Activation

Overview

IvyPlugin is the foundation for dependency management in sbt. It provides:
  • Dependency Resolution: Resolving and retrieving library dependencies
  • Artifact Publishing: Publishing artifacts to Ivy, Maven, and custom repositories
  • POM Generation: Creating Maven POM files from project metadata
  • Repository Management: Configuring resolvers and credentials
  • Module Metadata: Managing project organization, version, and artifact information

Core Tasks

From the plugin documentation:

Global Settings

Provided through globalIvyCore:

Module Identity

SettingTypeDefaultDescription
organizationString"0.1.0-SNAPSHOT"Module organization/group ID
versionString"0.1.0-SNAPSHOT"Module version
versionSchemeOption[VersionScheme]NoneVersioning scheme (e.g., semver, pvp)

Dependency Configuration

SettingTypeDefaultDescription
scalaOrganizationString"org.scala-lang"Organization for Scala dependencies
scalaArtifactsSeq[String]Standard artifactsNames of Scala library artifacts
crossVersionCrossVersionDisabled()Cross-version strategy for dependencies
internalConfigurationMapMap[Configuration, Configuration]Ivy internal mapMaps configurations to Ivy equivalents

Dependency Resolution

SettingTypeDefaultDescription
conflictManagerConflictManagerDefaultStrategy for resolving version conflicts
updateOptionsUpdateOptionsDefault optionsOptions controlling update behavior
forceUpdatePeriodOption[FiniteDuration]NoneForce updates after this period
checksumsSeq[String]From boot configChecksum algorithms to verify

Artifact Types

SettingTypeDefaultDescription
classpathTypesSet[String]JAR typesArtifact types included in classpaths
artifactClassifierOption[String]NoneDefault artifact classifier

Retrieval

SettingTypeDefaultDescription
retrieveManagedBooleanfalseCopy managed dependencies to lib_managed
retrieveManagedSyncBooleanfalseDelete removed dependencies from lib_managed
configurationsToRetrieveOption[Set[Configuration]]NoneConfigurations to retrieve

Tracking

SettingTypeDefaultDescription
trackInternalDependenciesTrackLevelTrackAlwaysTrack changes in inter-project dependencies
exportToInternalTrackLevelTrackAlwaysExport products to dependent projects
exportJarsBooleantrueExport packaged JARs instead of class directories

Repositories

SettingTypeDefaultDescription
sbtResolverResolverMaven Central or snapshotsResolver for sbt artifacts
sbtResolversSeq[Resolver]Vector(sbtResolver)Resolvers for sbt dependencies
credentialsSeq[Credentials]From environmentRepository authentication credentials

POM Customization

SettingTypeDefaultDescription
pomExtraNodeSeqEmptyExtra XML to include in generated POMs
pomPostProcessNode => NodeIdentityTransform generated POM XML
pomAllRepositoriesBooleanfalseInclude all project resolvers in POM
pomIncludeRepositoryMavenRepository => BooleanDefault filterFilter repositories in POM

Platform

SettingTypeDefaultDescription
platformPlatformPlatform.jvmTarget platform (JVM, JS, Native)

Coursier Settings

sbt uses Coursier as the default dependency resolver:
SettingTypeDefaultDescription
csrLoggerTask[CacheLogger]Coursier loggerLogger for Coursier operations
csrMavenProfilesSet[String]Empty setMaven profiles to activate
csrReconciliationsSeq[ModuleMatchers]Relaxed for allVersion reconciliation rules
csrMavenDependencyOverrideBooleanfalseAllow Maven dependency overrides
csrLocalArtifactsShouldBeCachedBooleanfalseCache local artifacts
csrCacheDirectoryFileDefault cacheCoursier cache location
csrSameVersionsSeq[Set[InclExclRule]]NilModule sets that must use same version
csrExtraCredentialsSeq[Credentials]NilAdditional Coursier credentials

Sonatype Publishing

SettingTypeDefaultDescription
stagingDirectoryFiletarget/sona-stagingStaging directory for bundles
localStagingOption[Resolver]Local staging resolverResolver for local staging
sonaBundleTask[File]Bundle creation taskCreate Sonatype bundle
sonaUploadRequestTimeoutFiniteDuration10 minutesUpload request timeout

Project Settings

Provided through ivyBaseSettings and ivyPublishSettings:

Module Metadata

SettingTypeDefaultDescription
nameStringProject IDProject/module name
normalizedNameStringNormalized nameName normalized for module ID
organizationStringnormalizedNameOrganization/group ID
organizationNameStringorganizationHuman-readable org name
organizationHomepageOption[URL]homepageOrganization website
descriptionStringnameProject description
homepageOption[URL]NoneProject homepage
startYearOption[Int]NoneProject start year
licensesSeq[(String, URL)]NilProject licenses
developersSeq[Developer]NilProject developers
scmInfoOption[ScmInfo]NoneSource control information

Project Info

Version Detection

Dependency Management

SettingTypeDefaultDescription
libraryDependenciesSeq[ModuleID]NilProject library dependencies
libraryDependencySchemesSeq[(ModuleID, VersionScheme)]NilVersion schemes for dependencies
dependencyOverridesSeq[ModuleID]EmptyForce specific dependency versions
excludeDependenciesSeq[InclExclRule]NilDependencies to exclude
allDependenciesTask[Seq[ModuleID]]ComputedAll project dependencies
buildDependenciesBuildDependenciesComputedInter-project dependency graph

Unmanaged Dependencies

Resolvers

SettingTypeDefaultDescription
resolversSeq[Resolver]NilAdditional dependency resolvers
externalResolversTask[Seq[Resolver]]ComputedAll external resolvers
fullResolversTask[Seq[Resolver]]ComputedAll resolvers including inter-project
bootResolversTask[Option[Seq[Resolver]]]From boot configResolvers from sbt launcher
appResolversTask[Option[Seq[Resolver]]]From app configApplication-level resolvers
overrideBuildResolversBooleanComputedOverride resolvers with boot config
includePluginResolversBooleanComputedInclude plugin resolvers

Conflict Management

SettingTypeDefaultDescription
conflictWarningConflictWarningDefaultConfiguration for conflict warnings
evictionWarningOptionsEvictionWarningOptionsDefaultOptions for eviction warnings
compatibilityWarningOptionsCompatibilityWarningOptionsDefaultOptions for compatibility warnings
evictionErrorLevelLevelLevel.ErrorLog level for eviction errors
assumedEvictionErrorLevelLevelLevel.InfoLog level for assumed evictions
assumedVersionSchemeVersionSchemeVersionScheme.AlwaysDefault version scheme
assumedVersionSchemeJavaVersionSchemeVersionScheme.AlwaysVersion scheme for Java deps

Logging

SettingTypeDefaultDescription
ivyLoggingLevelUpdateLoggingQuiet in CI, Default otherwiseIvy logging verbosity
ivyValidateBooleanfalseValidate Ivy files
offlineBooleanFrom system propertyWork in offline mode

Ivy XML

Default Configuration

Publishing

SettingTypeDefaultDescription
artifactsSeq[Artifact]NilArtifacts produced by project
packagedArtifactsTask[Map[Artifact, File]]Empty mapMap of artifacts to files
publishToOption[Resolver]NoneRepository for publishing
publishConfigurationPublishConfigurationComputedConfiguration for publish task
publishLocalConfigurationPublishConfigurationComputedConfiguration for publishLocal
publishM2ConfigurationPublishConfigurationComputedConfiguration for publishM2
makePomConfigurationMakePomConfigurationComputedConfiguration for makePom
deliverTask[File]Deliver taskCreate Ivy file for publishing
deliverLocalTask[File]Local deliver taskCreate local Ivy file
makeIvyXmlTask[File]Ivy XML taskGenerate Ivy XML file

Resolved Dependencies

Sonatype Central

Scala Version Alignment

Usage Examples

Add Library Dependencies

libraryDependencies ++= Seq(
  "org.typelevel" %% "cats-core" % "2.9.0",
  "org.scalatest" %% "scalatest" % "3.2.15" % Test
)

Configure Resolvers

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

Set Organization and Version

organization := "com.example"
version := "1.0.0"

Customize POM

pomExtra := (
  <developers>
    <developer>
      <id>dev</id>
      <name>Developer Name</name>
    </developer>
  </developers>
)

Configure Publishing

publishTo := Some(
  if (isSnapshot.value)
    "snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
  else
    "releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"
)

Add Credentials

credentials += Credentials(Path.userHome / ".sbt" / ".credentials")

Exclude Dependencies

libraryDependencies += "com.example" %% "library" % "1.0" exclude("org.unwanted", "artifact")

// Or globally
excludeDependencies ++= Seq(
  ExclusionRule("org.unwanted", "artifact")
)

Override Dependency Version

dependencyOverrides += "org.scala-lang" % "scala-library" % scalaVersion.value

Enable Offline Mode

offline := true

Configure Update Logging

ivyLoggingLevel := UpdateLogging.Quiet

Work with Snapshots

version := "1.0.0-SNAPSHOT"
isSnapshot := true // auto-detected, but can override

Configure Module Info

organization := "com.example"
organizationName := "Example Organization"
organizationHomepage := Some(url("https://example.com"))
startYear := Some(2024)
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt"))
developers := List(
  Developer(
    id = "dev1",
    name = "Developer One",
    email = "dev1@example.com",
    url = url("https://example.com/dev1")
  )
)
scmInfo := Some(
  ScmInfo(
    url("https://github.com/example/project"),
    "scm:git@github.com:example/project.git"
  )
)

Common Tasks

Update Dependencies

sbt update

Publish Locally

sbt publishLocal

Publish to Maven Local

sbt publishM2

Generate POM

sbt makePom

Publish to Remote

sbt publish
IvyPlugin uses Coursier as the default dependency resolver for better performance and reliability. Legacy Ivy resolver can be used by configuring useCoursier := false, but this is not recommended.
  • CorePlugin - Required dependency providing build infrastructure
  • JvmPlugin - Builds on IvyPlugin for JVM project capabilities

Source

IvyPlugin implementation: sbt.plugins.IvyPlugin