A place to chat about mill and ask questions. You can also use our new forum at Github Discussions (https://github.com/lihaoyi/mill/discussions)
github-actions[bot] on gh-pages
Updated github pages from commi… (compare)
lefou on main
Update trees to 4.5.8 (#1885) … (compare)
github-actions[bot] on gh-pages
Updated github pages from commi… (compare)
lefou on main
Add 'new' command for creating … Implement Giter8Module as an ex… Address PR comments and 5 more (compare)
lihaoyi on bump-upickle-2
Update build.sc (compare)
github-actions[bot] on gh-pages
Updated github pages from commi… (compare)
There seems to be what I would consider to be an error in mill 0.10.4 -- possibly in earlier version (I haven't checked). Here's what I see:
I've defined the following in a JAR archive that I build locally and add to the local maven repo (local maven coordinate "bmaso::mylib:0.0.1", package bmaso
):
package bmaso
import upickle.default.{ReadWriter => RW, macroRW}
case class DatasetFile(filename: String, timestamp: Long, size: Long)
object DatasetFile {
//...upickle RW so I can use this as the value type of a mill target...
implicit val rw: RW[DatasetFile] = macroRW
}
I have this very simple build.sc
script:
import $repo.`file://<my home dir>/.m2/repository`
import mill._, scalalib._
import $ivy.`bmaso::mylib:0.0.1`, bmaso._
def test = T {
DatasetFile("test", 1L, 1L)
}
I would expect mill show test
to just spit out the JSON representation of that DatasetFile object. Instead I get the following stack trace:
Exception in thread "MillServerActionRunner" java.lang.NoClassDefFoundError: scala/Serializable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
...(elided for readability)...
Caused by: java.lang.ClassNotFoundException: scala.Serializable
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at ammonite.runtime.SpecialClassLoader.findClass(ClassLoaders.scala:241)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 80 more
ReadWriter
in a jar loaded from the startup set of repos, or defined in the script itself, or in a script imported from a static location (using $file
). You just can't load from a JAR loaded from a dynamically-defined repo location
Out of interest: Have you tried (or are you aware of) mill-integrationtest, a plugin specifically for testing mill plugins? It is more loosely coupled to Mill than
TestEvaluator
, but on the other side, it allows more integrationtest-like setups and also supports tests against different Mill versions.
I gave it a shot, but I got blocked. Our plugin pulls dependencies from an internal artifactory. When the IT test runs, it tries to pull dependencies maven central instead. it ignores the configured repositoriesTask
. I tried configuring it in multiple places but I did not succeed (our plugin configures it, I added the configuration to the ittest
module I created, I also added the configuration in the test itself)
perTestResources
(see documentation: https://github.com/lefou/mill-integrationtest#configuration-and-targets), which could be a shared.sc
which you generate and include in each project under test
I have the feeling that something silly is happening, but I can't see it. Can anyone?
import $ivy.`com.disneystreaming.smithy4s::smithy4s-codegen:0.12.16`
import coursier.maven.MavenRepository
import mill._
import mill.api.PathRef
import mill.scalalib._
import os.Path
import smithy4s.codegen.{Codegen => Smithy4s}
import smithy4s.codegen.CodegenArgs
import scala.util._
trait Smithy4sModule extends ScalaModule {
}
And I get this;
Compiling /Users/simon/Code/mill-full-stack/mill-full-stack/project/smithy4s.sc
/Users/simon/Code/mill-full-stack/mill-full-stack/project/smithy4s.sc:8: value codegen is not a member of object ammonite.$file.project.smithy4s
import smithy4s.codegen.{Codegen => Smithy4s}
smithy4s.codegen
isn't part of them.
smithy4s
which Ammonite uses to create the object smithy4s
which wraps your code. You need to either change the imports to import _root_.smithy4s.codegen.{Codegen => Smithy4s}
etc. or rename the file to some other name.
mill
dir, and everthing went crazy.
CrossType.Full
sources
to add shared folder too?
build.sc
, you can't avoid it.
./out
does not support distribution
Hi there, I have troubles to get one module of my project in Intellij. Could someone help me to understand this error (which should have been fixed, so I expect my conf to cause this trouble):
mill.scalalib.GenIdea.idea java.lang.Exception: Duplicated item inserted into OrderedSet: /home/project/out/project/itest/resources.dest/resources
The only difference with other ScalaModules is that I compile other modules to test those jars:
object itest extends IntegrationTests {
def moduleDeps = super.moduleDeps ++ Seq(main.test)
def programAsItResource(dest: os.Path, jar: PathRef, name: String) = {
val folder = dest / "resources"
val targetFolder = folder / "programs"
os.makeDir.all(targetFolder)
os.hardlink(targetFolder / s"$name.jar", jar.path)
PathRef(folder)
}
override def resources = T.sources {
super.resources() :+
programAsItResource(T.dest, program.jar(), "program") :+
programAsItResource(T.dest, local_error.jar(), "local_error")
}
}
mill.api.Strict.Agg
which enforces uniqueness strictly. You can instead use mill.api.Loose.Agg
or just mill.Agg
.
tools=mill
and the template can decide whether it should create a build.sc
vs. a build.sbt
?
I want to run two mill commands in two different shell (one to watch changes and restart my API, and the other one to reload my frontend):
mill -w __.frontend.public # shell number 1
mill -w __.backend.runBackground # shell number 2
however I notice that as soon as I run the second one, a new MillServerMain
process appears, which make me think that they are not using the same mill server:
% jps -l ✹
3283331 mill.main.client.MillClientMain
3283361 mill.main.MillServerMain <-- this
3283431 jdk.jcmd/sun.tools.jps.Jps
3283092 mill.main.MillServerMain <--- this
3127320 bloop.Server
3283147 mill.scalalib.backgroundwrapper.BackgroundWrapper
3249739 scala.meta.metals.Main
3283069 mill.main.client.MillClientMain
Is there a way to run multiple mill client against the same server ?
Note that I've tried to run mill -w __.frontend.public + __.backend.runBackground
but in this specific case it does not work because each time the frontend is changed the backend is restarted as well