You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[info] compiling 1 Scala source to /Users/James.Clark/IdeaProjects/mill-cycle-module-import/out/mill-build/compile.dest/classes ...
[error] /Users/James.Clark/IdeaProjects/mill-cycle-module-import/build.sc:7:8: encountered unrecoverable cycle resolving import.
[error] Note: this is often due in part to a class depending on a definition nested within its companion.
[error] If applicable, you may wish to try moving some members into another object.
[error] import utils._
[error] ^
[error] /Users/James.Clark/IdeaProjects/mill-cycle-module-import/build.sc:11:27: Modules, Targets and Commands can only be defined within a mill Module
[error] object utils extends mill.Module {
[error] ^
[error] two errors found
1 targets failed
compile Compilation failed
In this short example you're pointed in the right direction (but, at least to me, it's not clear that the solution is to not have this import as in the first example).
If you move the imports around, the error changes too. Just by reordering, you could get e.g.
[error] import mill._
[error] ^
[error] /Users/James.Clark/IdeaProjects/mill-cycle-module-import/build.sc:1:8: encountered unrecoverable cycle resolving import.
[error] Note: this is often due in part to a class depending on a definition nested within its companion.
[error] If applicable, you may wish to try moving some members into another object.
[error] import utils._
That's still not too bad, it still talks about utils at least.
[build.sc] [49/53] compile
[info] compiling 1 Scala source to /Users/James.Clark/IdeaProjects/mill-cycle-module-import/out/mill-build/compile.dest/classes ...
[error] /Users/James.Clark/IdeaProjects/mill-cycle-module-import/build.sc:7:13: encountered unrecoverable cycle resolving import.
[error] Note: this is often due in part to a class depending on a definition nested within its companion.
[error] If applicable, you may wish to try moving some members into another object.
[error] import mill.scalalib._
[error] ^
[error] /Users/James.Clark/IdeaProjects/mill-cycle-module-import/build.sc:6:8: encountered unrecoverable cycle resolving import.
[error] Note: this is often due in part to a class depending on a definition nested within its companion.
[error] If applicable, you may wish to try moving some members into another object.
[error] import root._
[error] ^
[error] two errors found
1 targets failed
compile Compilation failed
mill-cycle-module-import mill sayProblem
No mill version specified.
You should provide a version via '.mill-version' file or --mill-version option.
Using mill version 0.11.7
[build.sc] [47/53] zincReportCachedProblems
Unknown ctx of target sayThing: millbuild.build$utils$@747a0827
I added extends mill.Module as that error lead to this suggestion at #2888 (comment)
I couldn't find an issue when searching for encountered unrecoverable cycle resolving import, so at least this should help anyone who comes across the same 👍
The text was updated successfully, but these errors were encountered:
I guess re-using public targets and commands defined elsewhere is never a good idea. Instead, you should define a new command with T.command { .. } and call (meaning: depend on) the other command from there. E.g.:
Even, better, make the sayThing command an annonymous task with T.task { .. }.
Unfortunately, the types are correct, therefore the compiler will not call our implicit conversions here. The proper definition of a command should always contain the T.commnad { .. } on the left hand side, which is not the case in the definition of sayProblem in all of your examples. That means, the commands context isn't correct.
This build.sc works OK:
This build.sc hits the titular issue:
In this short example you're pointed in the right direction (but, at least to me, it's not clear that the solution is to not have this import as in the first example).
If you move the imports around, the error changes too. Just by reordering, you could get e.g.
That's still not too bad, it still talks about
utils
at least.What if you have a bunch more imports?
We've lost the guidance towards this bad import.
How did we arrive at this bad import?
In mill 0.10.n, this is OK:
But in 0.11.m, you get:
I added
extends mill.Module
as that error lead to this suggestion at #2888 (comment)I couldn't find an issue when searching for
encountered unrecoverable cycle resolving import
, so at least this should help anyone who comes across the same 👍The text was updated successfully, but these errors were encountered: