GithubHelp home page GithubHelp logo

Comments (8)

ckipp01 avatar ckipp01 commented on August 30, 2024 1

Thanks a ton for you work on tracking this down and for explaining it. This makes sense and seems doable. I've just been playing around a bit with Mill so this will be good for me to try and figure out and fix. If it's alright I'll leave this open a bit just to reference until I get it fixed. Thanks again @alexarchambault πŸ™ .

from apps.

ckipp01 avatar ckipp01 commented on August 30, 2024 1

This is taken care of now in com-lihaoyi/mill#941

from apps.

alexarchambault avatar alexarchambault commented on August 30, 2024

@ckipp01 Could it be a mill version mismatch? I'm getting the following:

$ cs launch mill:0.7.3 -- app.run
Compiling /Users/alexandre/projects/test/minimalApplication-0.7.3/build.sc
[26/36] app.compile
Compiling compiler interface...
9 warnings
[info] Compiling 1 Scala source to /Users/alexandre/projects/test/minimalApplication-0.7.3/out/app/compile/dest/classes ...
[info] Done compiling.
[36/36] app.run
juil. 27, 2020 3:52:07 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
juil. 27, 2020 3:52:07 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
^C

$ cs launch mill:0.8.0 -- app.run
[26/36] app.compile
[info] Compiling 1 Scala source to /Users/alexandre/projects/test/minimalApplication-0.7.3/out/app/compile/dest/classes ...
[info] Done compiling.
[28/36] app.finalMainClass
1 targets failed
app.finalMainClass No main class specified or found

Right now, the mill binary installed by cs isn't really a universal mill launcher… It only launches its own mill version, which may not be the one of the project at hand.

from apps.

ckipp01 avatar ckipp01 commented on August 30, 2024

Yes so that's exactly what I see as well @alexarchambault. I guess the thing that confuses me is that in the minimalApplication-0.7.3 the DEFAULT_MILL_VERSION is set to 0.7.3 and again, this works. If I manually change that value for it to default to 0.8.0 and then run ./mill app.run it still works. But then when again running from mill app.run it doesn't find the main class.

Just to be super clear:

  1. Freshly unzip the project and run with coursier installed mill
❯ cs launch mill:0.8.0 -- app.run
Compiling /Users/ckipp/Downloads/minimalApplication-0.7.3/build.sc
[26/36] app.compile
[info] Compiling 1 Scala source to /Users/ckipp/Downloads/minimalApplication-0.7.3/out/app/compile/dest/classes ...
[info] Done compiling.
[28/36] app.finalMainClass
1 targets failed
app.finalMainClass No main class specified or found
  1. Try with mill wrapper, see version change and it works
❯ ./mill app.run
Mill version changed (0.8.0 -> 0.7.3), re-starting server
[36/36] app.run
Jul 27, 2020 4:05:44 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Jul 27, 2020 4:05:44 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
  1. So then manually change DEFAULT_MILL_VERSION to 0.8.0 in wrapper and try again
❯ ./mill --version
Mill Build Tool version 0.8.0
Java version: 1.8.0_242, vendor: BellSoft, runtime: /Users/ckipp/.sdkman/candidates/java/8.0.242-librca/jre
Default locale: en_NL, platform encoding: UTF-8
OS name: "Mac OS X", version: 10.15.5, arch: x86_64
...
❯ ./mill app.run
Compiling /Users/ckipp/Downloads/minimalApplication-0.7.3/build.sc
[36/36] app.run
Jul 27, 2020 4:08:37 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Jul 27, 2020 4:08:37 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
  1. Then try again with mill installed via coursier
❯ cs launch mill:0.8.0 -- app.run
Compiling /Users/ckipp/Downloads/minimalApplication-0.7.3/build.sc
[26/36] app.compile
[info] Compiling 1 Scala source to /Users/ckipp/Downloads/minimalApplication-0.7.3/out/app/compile/dest/classes ...
[info] Done compiling.
[28/36] app.finalMainClass
1 targets failed
app.finalMainClass No main class specified or found

So I just don't get why using ./mill app.run here and cs launch mill:0.8.0 -- app.run don't act the same when they are using 0.8.0. If you don't think this has anything to do with Coursier, by all means close it, but when I pointed this out to Li Haoyi he pointed me here.

from apps.

alexarchambault avatar alexarchambault commented on August 30, 2024

Mmmhh… Something may have changed in the way mill starts, or maybe we don't fetch the exact same class path as the one it generates its assembly with…

Bisected that to those commits:

$ cs launch mill:0.7.4-5-438ebc -- app.run
[26/36] app.compile
Compiling compiler interface...
9 warnings
[info] Compiling 1 Scala source to /Users/alexandre/projects/test/minimalApplication-0.7.3/out/app/compile/dest/classes ...
[info] Done compiling.
[36/36] app.run
juil. 27, 2020 5:18:06 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
juil. 27, 2020 5:18:06 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
^C

$ cs launch mill:0.7.4-7-6b492a -- app.run
[26/36] app.compile
[info] Compiling 1 Scala source to /Users/alexandre/projects/test/minimalApplication-0.7.3/out/app/compile/dest/classes ...
[info] Done compiling.
[28/36] app.finalMainClass
1 targets failed
app.finalMainClass No main class specified or found

from apps.

alexarchambault avatar alexarchambault commented on August 30, 2024

Possibly a class path issue then… Those forced versions do not end up in the POM, so we don't respect them when fetching mill from coursier.

from apps.

alexarchambault avatar alexarchambault commented on August 30, 2024

Yeah, confirmed:

$ cs launch mill:0.7.4-7-6b492a -V org.scalameta:trees_2.13:4.3.7 -- app.run
Compiling /Users/alexandre/projects/test/minimalApplication-0.7.3/build.sc
[26/36] app.compile
Compiling compiler interface...
9 warnings
[info] Compiling 1 Scala source to /Users/alexandre/projects/test/minimalApplication-0.7.3/out/app/compile/dest/classes ...
[info] Done compiling.
[36/36] app.run
juil. 27, 2020 5:23:20 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
juil. 27, 2020 5:23:20 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
^C

from apps.

alexarchambault avatar alexarchambault commented on August 30, 2024

Basically, to fix that, mill itself should exclude org.scalameta::trees when it depends on com.lihaoyi:::ammonite-interp:

$ cs resolve mill:0.7.4-7-6b492a --what-depends-on org.scalameta:trees_2.13
  Result:
└─ org.scalameta:trees_2.13:4.3.20
   β”œβ”€ com.lihaoyi:ammonite-interp_2.13.2:2.2.0
   β”‚  β”œβ”€ com.lihaoyi:ammonite-repl_2.13.2:2.2.0
   β”‚  β”‚  └─ com.lihaoyi:ammonite_2.13.2:2.2.0
   β”‚  β”‚     └─ com.lihaoyi:mill-main-core_2.13:0.7.4-7-6b492a
   β”‚  β”‚        └─ com.lihaoyi:mill-main_2.13:0.7.4-7-6b492a
   β”‚  β”‚           └─ com.lihaoyi:mill-scalalib_2.13:0.7.4-7-6b492a
   β”‚  β”‚              β”œβ”€ com.lihaoyi:mill-dev_2.13:0.7.4-7-6b492a
   β”‚  β”‚              β”œβ”€ com.lihaoyi:mill-scalajslib_2.13:0.7.4-7-6b492a
   β”‚  β”‚              β”‚  └─ com.lihaoyi:mill-dev_2.13:0.7.4-7-6b492a
   β”‚  β”‚              └─ com.lihaoyi:mill-scalanativelib_2.13:0.7.4-7-6b492a
   β”‚  β”‚                 └─ com.lihaoyi:mill-dev_2.13:0.7.4-7-6b492a
   β”‚  └─ com.lihaoyi:ammonite_2.13.2:2.2.0
   β”‚     └─ com.lihaoyi:mill-main-core_2.13:0.7.4-7-6b492a
   β”‚        └─ com.lihaoyi:mill-main_2.13:0.7.4-7-6b492a
   β”‚           └─ com.lihaoyi:mill-scalalib_2.13:0.7.4-7-6b492a
   β”‚              β”œβ”€ com.lihaoyi:mill-dev_2.13:0.7.4-7-6b492a
   β”‚              β”œβ”€ com.lihaoyi:mill-scalajslib_2.13:0.7.4-7-6b492a
   β”‚              β”‚  └─ com.lihaoyi:mill-dev_2.13:0.7.4-7-6b492a
   β”‚              └─ com.lihaoyi:mill-scalanativelib_2.13:0.7.4-7-6b492a
   β”‚                 └─ com.lihaoyi:mill-dev_2.13:0.7.4-7-6b492a
   └─ com.lihaoyi:mill-main-core_2.13:0.7.4-7-6b492a org.scalameta:trees_2.13:4.3.7 -> 4.3.20
      └─ com.lihaoyi:mill-main_2.13:0.7.4-7-6b492a
         └─ com.lihaoyi:mill-scalalib_2.13:0.7.4-7-6b492a
            β”œβ”€ com.lihaoyi:mill-dev_2.13:0.7.4-7-6b492a
            β”œβ”€ com.lihaoyi:mill-scalajslib_2.13:0.7.4-7-6b492a
            β”‚  └─ com.lihaoyi:mill-dev_2.13:0.7.4-7-6b492a
            └─ com.lihaoyi:mill-scalanativelib_2.13:0.7.4-7-6b492a
               └─ com.lihaoyi:mill-dev_2.13:0.7.4-7-6b492a

That way, org.scalameta::trees would stay on 4.3.7 and wouldn't be bumped to 4.3.20, and the forceVersion() wouldn't be necessary.

from apps.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.