Skip to content

Error when using 0.11 plugin with Mill 0.12 #4390

Open
@carlosedp

Description

@carlosedp

We have been discussing this issue at ckipp01/mill-ci-release#134 and ckipp01/mill-ci-release#143 regarding using a 0.11 plugin (which also has a 0.12 version published) but the project gets the 0.11 as default since it's supposedly binary compatible.

In this case, when using the mill-ci-release plugin like import $ivy.io.chris-kipp::mill-ci-release::0.3.0`` on my mill-aliases plugin (which is in 0.12.5 in this branch: https://github.com/carlosedp/mill-aliases/tree/mill012), I get:

❯ ./mill io.kipp.mill.ci.release.ReleaseModule/publishAll
[build.sc-64/68] compile
[build.sc-64] [info] compiling 1 Scala source to /Users/cdepaula/repos/scala/mill-aliases/out/mill-build/compile.dest/classes ...
[build.sc-64] [info] done compiling
[68/68] ============================== io.kipp.mill.ci.release.ReleaseModule/publishAll ============================== 4s
java.lang.ClassCastException: class scala.Tuple2 cannot be cast to class scala.Tuple3 (scala.Tuple2 and scala.Tuple3 are in unnamed module of loader 'app')
    mill.resolve.Resolve$.$anonfun$invokeCommand0$1(Resolve.scala:163)
    mill.resolve.Resolve$.$anonfun$invokeCommand0$1$adapted(Resolve.scala:163)
    scala.collection.MapOps$WithFilter.$anonfun$withFilter$1(Map.scala:402)
    scala.collection.MapOps$WithFilter.$anonfun$withFilter$1$adapted(Map.scala:402)
    scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
    scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:601)
    scala.collection.immutable.List.prependedAll(List.scala:152)
    scala.collection.immutable.List$.from(List.scala:685)
    scala.collection.immutable.List$.from(List.scala:682)
    scala.collection.IterableFactory$Delegate.from(Factory.scala:288)
    scala.collection.immutable.Iterable$.from(Iterable.scala:35)
    scala.collection.immutable.Iterable$.from(Iterable.scala:32)
    scala.collection.IterableOps$WithFilter.flatMap(Iterable.scala:903)
    mill.resolve.Resolve$.invokeCommand0(Resolve.scala:163)
    mill.resolve.Resolve$.$anonfun$instantiateCommand$1(Resolve.scala:148)

The way to overcome this is to hard-code the mill 0.12 version of the plugin which makes it work:

import $ivy.`io.chris-kipp::mill-ci-release_mill0.12:0.3.0`

I understand it should either work with the 0.11 version or fetch the 0.12 version in case it's available.

Maybe a workaround would be having a variable that holds the Mill binary version (which should be "0.11", "0.12", etc) that we could import like:

import $ivy.`io.chris-kipp::mill-ci-release_mill$MILL_BIN_VERSION:0.3.0`

Or something like that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions