Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9148019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:09:29+00:00 2026-06-17T11:09:29+00:00

Is there an equivalent to Leiningen’s checkouts feature in sbt? Here is what I

  • 0

Is there an equivalent to Leiningen’s “checkouts” feature in sbt?

Here is what I want to accomplish:

I have two projects, an application Foo and library “Bar“. I want to publish each of these projects independently. Foo depends on Bar, and the sbt project will direct sbt to download the jar for “Bar” from a repository whenever a third-party tries to build “Foo” (which is typical behavior).

Now, say I want to hack on both Foo and Bar at the same time. For example, while working on Foo, I want to directly edit and debug some of the source for Bar so the edits affect Foo (and then later rebuild Bar when it is convenient).

How can I instruct sbt to satisfy its dependency on Bar from its source code on my machine (rather than my local repository) during this hack session?

(P.S. I asked a similar question for Clojure/Leiningen. Leiningen has the “checkouts” feature which accomplishes this. I am wondering if there is something similar in sbt…)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:09:31+00:00Added an answer on June 17, 2026 at 11:09 am

    You can declare a source dependency from Foo to Bar via a project reference:

    import sbt._
    
    object FooBuild extends Build {
      lazy val root = Project(
        id = "foo",
        base = file(".")
      ) dependsOn(theBarBuild)
    
      lazy val theBarBuild = ProjectRef(
        base = file("/path/to/bar"),
        id = "bar")
    }
    

    This should also recompile Bar (if it has changed) whenever you compile Foo. Please note that the id of the project reference must match the actual id of the Bar project, which might be something like e.g. default-edd2f8 if you use a simple build definition (.sbt files only).

    This technique is especially useful for plug-ins (see my blog post about this topic).

    Edit:

    You can kind of re-code the checkout behaviour like this:

    import sbt._
    
    object FooBuild extends Build {
      lazy val root = addCheckouts(Project(id = "foo", base = file(".")))
    
      def addCheckouts(proj: Project): Project = {
        val checkouts = proj.base.getCanonicalFile / "checkouts"
        if (! checkouts.exists) proj
        else proj.dependsOn(IO.listFiles(DirectoryFilter)(checkouts).map { dir =>
          ProjectRef(base = dir, id = dir.name): ClasspathDep[ProjectReference]
        }:_*)
      }
    }
    

    This checks your project directory for a checkouts directory, and if it exists, adds the directories therein (which should be symlinks to other projects) as project references to the project. It expects the symlink to be named like the actual ID of the linked project (e.g. default-edd2f8 or bar). If the directory doesn’t exist, the build just works as before.

    When you add or remove a symlink in the checkouts directory (or the directory itself), you must reload the Foo project to pick up the changes.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an equivalent to Eclipse's Scrapbook feature in Intellij Idea? (Before I go
Is there some equivalent of javascripts indexOf in Velocity? I want to test whether
Is there an equivalent to Apache Camel in Rails ?! I'm creating an application
Is there an equivalent to Apache's VirtualHost for IIS? We want to be able
Is there equivalent of Android Interface Definition Language (AIDL) on BlackBerry mobile? We have
Are there equivalent to perl -c syntax check for JavaScript from command? Given that
Is there equivalent to \Q ... \E in C# Regex? I can't find it.
Is there an equivalent Matlab dot function in numpy? The dot function in Matlab:
Is there an equivalent in SDK 2 to the SDK 1 navigation utilities? I'd
Is there an equivalent to the following: header(Content-type: text/xml); I'm using Google Maps with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.