Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No main class specified or found when overriding zincWorker #4659

Open
dontgitit opened this issue Mar 5, 2025 · 1 comment
Open

No main class specified or found when overriding zincWorker #4659

dontgitit opened this issue Mar 5, 2025 · 1 comment

Comments

@dontgitit
Copy link

Hello,

I put together a very simple hello world app, but experienced strange behavior once I added a zincWorker override; my main class could no longer be detected. The full sample app can be found here. Commenting out this line makes the app run as expected.

Let me know if any additional info is needed.

@lefou
Copy link
Member

lefou commented Mar 5, 2025

I can reproduce it.

build.sc

import mill.scalalib._
import mill.define.ModuleRef

object ZincWorkerJava21 extends ZincWorkerModule {
  def jvmId = "temurin:21.0.6"
}

object foo extends ScalaModule {
  def scalaVersion = "3.6.3"
  // commenting out the zincWorker makes the app run
  override def zincWorker = ModuleRef(ZincWorkerJava21)
  // alternatively, uncomment this for an explicit main class
  //  def mainClass = Some("Foo")
}

.mill-version

0.12.8

foo/src/Foo.scala

object Foo {
  def main(args: Array[String]): Unit = println("hello world")
}
> mill --version
Mill Build Tool version 0.12.8
Java version: 21.0.5, vendor: Eclipse Adoptium, runtime: /opt/openjdk-bin-21.0.5_p11
Default locale: de_DE, platform encoding: UTF-8
OS name: "Linux", version: 6.6.74-gentoo-x86_64, arch: amd64

> mill foo.run
[build.sc-61/65] compile
[build.sc-61] [info] compiling 1 Scala source to /tmp/mill-2/out/mill-build/compile.dest/classes ...
[build.sc-61] [info] done compiling
[58/66] foo.compile
[58] [info] compiling 1 Scala source to /tmp/mill-2/out/foo/compile.dest/classes ...
[58] [info] done compiling
[66/66] ============================== foo.run ============================== 62s
1 tasks failed
foo.finalMainClass No main class specified or found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants