- Add ivylessPublishMavenToFile and ivylessPublishMavenToUrl for Maven layout
- Handle MavenCache and MavenRepo in ivylessPublishTask (file + HTTP)
- Add credentialFor for realm+host credential matching per Publishing docs
- Consume HTTP response body on success to avoid connection leak
- Add scripted tests: ivyless-publish-maven, ivyless-publish-maven-http
When using the aggregated key parser, a key is now valid if it exists in `data` for that scope **or** it's an aggregate key and every key it aggregates to exists in `data`. So `(root, scripted)` is accepted when the root aggregates a project that defines `scripted`, and running `scripted` at root runs it on that project as before.
Implements ivyless publish task as part of #7639 (drop Ivy dependency).
Fixes#8639.
- Add ivylessPublish for URLRepository: HTTP PUT with optional Basic auth,
same layout as ivyless publishLocal (artifacts + ivy.xml + checksums).
- Add ivylessPublishToFile for FileRepository: write to local path for
testing without HTTP server.
- Add ivylessPublishTask: when useIvy is false, use ivyless path for
URLRepository or FileRepository; otherwise use Ivy.
- Wire publish in Defaults to LibraryManagement.ivylessPublishTask
(tagged Publish, Network).
- Add scripted test dependency-management/ivyless-publish using
Resolver.file to verify ivyless publish produces identical layout.
Credentials supported via allCredentials (Basic auth for PUT).
When a project depended on another project that was built with a different Scala binary version (e.g. 2.12 vs 2.13), compilation could fail with "not found: value X" because resolution was asking for the wrong artifact.
This change updates how we build the `ModuleID` for inter-project dependencies in `projectDependenciesTask`: we now request the dependency’s Scala binary version (e.g. `bar_2.12`) instead of the current project’s, so the resolver can find the right artifact. We keep existing behavior for `Disabled` and `Constant` cross-version, and add a small safeguard in the default case when the dependency’s Scala version differs from the current project’s.
**Consuming BOMs**
- You can declare a BOM with `.pomOnly()` and versionless deps with `"*"`:
- `libraryDependencies += ("com.fasterxml.jackson" % "jackson-bom" % "2.21.0").pomOnly()`
- `libraryDependencies += "com.fasterxml.jackson.core" % "jackson-core" % "*"`
- BOMs are passed to Coursier via `Resolve.addBom()`; version `"*"` is resolved from the BOM.
**makePom**
- POM-only dependencies are emitted under `<dependencyManagement><dependencies>...</dependencies></dependencyManagement>` with `<type>pom</type>` and `<scope>import</scope>`.
- Dependencies with version `"*"` are emitted without a `<version>` element so Maven uses the BOM-managed version.
**Ivy / publishLocal emulation**
- When publishing to Ivy (e.g. `publishLocal`), BOM-resolved versions (deps that had `"*"`) are written into the published `ivy.xml` as forced dependencies (`force="true"`), so consumers that depend on this module get those versions.
**Problem**
1. Write a scripted test that runs sbt in that test.
2. sbt writes `sbt.version` under `project/build.properties`, which acts as a test filter.
3. The test setup is implicitly altered.
**Solution**
Before writing `build.properties`, sbt checks whether the base directory is inside a scripted test directory (path contains `sbt-test`). If so, it skips writing so the test setup is not altered.
Add a rootProject convenience macro that expands to a Project with base "."
and the enclosing val name as id. Allows writing `val root = rootProject`
instead of `val root = (project in file("."))` for a stable root project id.
**Problem**
Some scripted tests are failing due to the fact that -bin-SNAPSHOT
isn't being recognized.
**Solution**
This fixes sbtApiVersion to recognize BinCompatV.
When input lacks 'jsonrpc' field (e.g. {}), call System.exit(1) instead
of throwing IllegalArgumentException. Avoids noisy stack traces in
CI from WorkerExchangeTest's intentional bad-input tests.
Resolving ThisProject to ProjectRef(uri, p.id) created a self-reference
in the aggregate (and dependency) list. BuildUtil.checkCycles runs
topological sort on this relation and throws Cyclic when it sees the
self-loop.
Treat ThisProject as no-op: resolve to Vector.empty so the build loads
without error. aggregate(ThisProject) / dependsOn(ThisProject) is
effectively a no-op (self is already included).
Fixes#3616 - Scope's resolveProjectBuild and resolveProjectRef
mishandle ThisProject.
Previously, using ThisProject in aggregate() or dependsOn() would
cause a runtime error: 'Cannot resolve ThisProject w/o the current
project'.
This change adds proper handling for ThisProject in Load.scala:
- In checkAll: Skip validation for ThisProject (refers to self)
- In resolveProjects: Resolve ThisProject to ProjectRef(uri, p.id)
Problem
When a user defines an alias with a name that matches an existing task or setting key (e.g., `alias c = compile` when a custom task `c` exists), the alias silently wins and shadows the task.
Solution
Detect conflicts at alias creation time and fail with an error message:
```
Alias 'c' conflicts with a task or setting key of the same name. Use a different alias name to avoid ambiguity.
```
**Problem**
When multiple clients connect to the same sbt server, they all share the same "current project" state. When one client switches projects with `project X`, all other clients see that change.
**Solution**
Store per-channel project cursors in State attributes. Each client maintains its own cursor that tracks which project it has selected.
Windows CMD interprets parentheses as special syntax for command grouping.
When the project directory path contains parentheses (e.g., in username),
the batch script fails with ') was unexpected at this time.' error.
This fix stores the current directory in a variable using delayed expansion
(!CURRENT_DIR!) instead of using %CD% directly, which properly handles
paths containing parentheses and other special characters.
Fixes#8644
In PR #8621, I added a new `keepTempDirectory` parameter to `ScriptedRun.run()` and `invoke()` methods. To suppress MiMa warnings, I added `mimaBinaryIssueFilters` for:
- `DirectMissingMethodProblem("sbt.ScriptedRun.run")`
- `DirectMissingMethodProblem("sbt.ScriptedRun.invoke")`
- `DirectMissingMethodProblem` for various internal `RunV1`, `RunV2`, `RunInParallelV1`, `RunInParallelV2` classes
However, this broke binary compatibility, which prevents sbt 1.x from calling sbt 2.x for cross-building (building sbt 2.x plugins using sbt 1.x).
Fixes#8627
- Use ${OUT} placeholder and remove StringVirtualFile1 special-case handling
- Make dirZipExt check generic (use vf instead of svf: StringVirtualFile1)
- Let syncBlobs handle StringVirtualFile1 transparently via fileConverter.toPath()
When a bundle upload to Central Portal fails, the error now displays the HTTP response body instead of just the status code. This provides more useful debugging information, as the response body typically contains detailed error messages from the server.
**Problem**
getPropertiesFor method calls getResource().openStream() without checking
if getResource returns null. When a resource doesn't exist, this causes
a NullPointerException with no context about which resource was missing.
**Solution**
Added null check before calling openStream() and throw a descriptive
FileNotFoundException with the resource name if the resource is not found.
This prevents NullPointerException and provides better error messages.
Generated-by: Auto
Fixes#8631
**Changes:**
- Add `useIvy` setting key (defaults to `true`)
- Add `ivylessPublishLocalImpl` helper that publishes without Ivy
- Modify `publishLocal` to use ivyless publisher when `useIvy := false`
- Generate ivy.xml via `lmcoursier.IvyXml`
- Generate MD5/SHA-1 checksums for all files
- Add scripted test `dependency-management/ivyless-publish-local`
## Problem
We enforce same-version policy for scala-reflect in Scala 2.13.
However due to sandwich dependency, the graph can bump
scala-library to 3.8.1, which is missing scala-reflect counterpart.
## Solution
Drop the same-version policy.
This adds a scripted integration test to verify that the `bspConfig` task correctly generates a valid BSP connection file (`.bsp/sbt.json`) when the embedded launcher JAR is present in the classpath.
**Problem**
When running scripted tests to debug sbt plugins, the temporary directories (`/private/var/folder/...`) are automatically deleted after tests complete. This makes it difficult to inspect the test state for debugging purposes, requiring workarounds like adding `$ pause` commands and manually copying directories.
**Solution**
Added a new `scriptedKeepTempDirectory` setting that allows users to preserve temporary directories after scripted tests complete. When enabled, the temporary directory path is logged so users can inspect it.
Usage:
```scala
scriptedKeepTempDirectory := true
```
Problem
When using `addCompilerPlugin((dependency) % Test)`, the compiler plugin was incorrectly added to BOTH `test:scalacOptions` AND `compile:scalacOptions`, instead of only `test:scalacOptions`.
Solution
Throw when the dependency is scoped, since we do not support this use case.
- Add `versionSatisfiesRange()` function to `VersionRange.scala` supporting Maven-style ranges (`[x,y)`, `(x,y]`, `[x,)`, etc.) and plus ranges (`1.0+`)
- Check if winner version satisfies evicted module's version range in `guessCompatible()`