^compile does not resolve internal `dependsOn` project dependency
See original GitHub issuesteps
Given a project definition which includes both an sbt plugin and a non-plugin project that the sbt plugin depends on:
inThisBuild(
Seq(
organization := "com.example",
version := "0.1"
)
)
lazy val root = (project in file("."))
.aggregate(library, plugin)
.enablePlugins(CrossPerProjectPlugin)
val library = (project in file("library"))
.settings(
scalaVersion := "2.10.6",
crossScalaVersions := Seq("2.10.6", "2.12.3")
)
val plugin = (project in file("plugin"))
.settings(
sbtPlugin := true,
crossSbtVersions := Seq("0.13.16", "1.0.0-RC3")
)
.dependsOn(library)
problem
When attempting to cross-compile the plugin for the given sbt versions, the following error occurs during dependency resolution:
> ^compile
[info] Setting `sbtVersion in pluginCrossBuild` to 0.13.16
[info] Set current project to plugin (in build file:/Users/jeffo/Projects/jvm/sbt-issue/)
[success] Total time: 0 s, completed Jul 31, 2017 9:58:42 AM
[info] Setting `sbtVersion in pluginCrossBuild` to 1.0.0-RC3
[info] Set current project to plugin (in build file:/Users/jeffo/Projects/jvm/sbt-issue/)
[info] Resolving com.example#library_2.12;0.1 ...
[warn] module not found: com.example#library_2.12;0.1
[logging elided] ...
[info] Resolving jline#jline;2.14.3 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.example#library_2.12;0.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.example:library_2.12:0.1
[warn] +- com.example:plugin:0.1 (scalaVersion=2.12, sbtVersion=1.0)
[trace] Stack trace suppressed: run last plugin/*:update for the full output.
[error] (plugin/*:update) sbt.ResolveException: unresolved dependency: com.example#library_2.12;0.1: not found
expectation
I would expect that when issuing ^compile
, the internal projects that my plugin depends on would be available to it without have to do a publishLocal
or +publishLocal
.
notes
The ^compile
task succeeds if I manually issue +publishLocal
from the library
project before attempting ^compile
.
sbt version: 0.13.16, cross building for 0.13.16 and 1.0.0-RC3
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Declaring Dependencies between Subprojects
The api project has a dependency on the shared project. It has no build script and gets nothing injected by another build script....
Read more >How to let gradle build dependent sub-project first when using ...
Gradle build order is never on the project level, but always on the task level. from(configuration.schemas) would infer task dependencies ...
Read more >4. Dependency Management - Gradle Beyond the Basics [Book]
Every Gradle project has an internal list of repositories. By default, this list is empty, but we can add to it by using...
Read more >Add build dependencies - Android Developers
This page describes how to use dependencies with your Android project, ... If the library does not already exist locally, Gradle pulls it...
Read more >Introduction to the Dependency Mechanism - Apache Maven
There is no limit to the number of levels that dependencies can be ... Compile dependencies are available in all classpaths of a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@eed3si9n I had tried that, but unfortunately I ran into another issue which forced me to reinstate the
scalaVersion
on the subprojects. I am still trying to track down exactly what is the cause of this other issue, but it’s something like:When running
^compile
for projectB, I would get:The way I worked around this was not using
dependsOn
, but just adding alibraryDependency
(and issuingpublishLocal
) to projectA on projectB like I did for the library and plugindependsOn
issue above.I believe this only happens when I have the
scripted
dependency, so maybe I should be doing something different in myplugins.sbt
when attempting to cross-build for 0.13 and 0.1. Currently, myplugins.sbt
has the standard:UPDATE: Seems like this other issue would be fixed by https://github.com/sbt/sbt/issues/3325
To avoid adding
scalaVersion
at the project level by default, in #3356 I started appendingscalaVersion
at the project level only for the current subproject. In the hindsight I was walking into the situation like this whenever there’s a plugin that depends on other subprojects.We could try issuing
++2.x.y
inside^^
command as fix.