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

Scala 3.5.2 artifacts seem to contain empty jars #21926

Closed
rubin55 opened this issue Nov 11, 2024 · 9 comments
Closed

Scala 3.5.2 artifacts seem to contain empty jars #21926

rubin55 opened this issue Nov 11, 2024 · 9 comments
Labels

Comments

@rubin55
Copy link
Contributor

rubin55 commented Nov 11, 2024

I downloaded both the zip and tar.gz versions of scala-3.5.2 on the releases page.

In the lib directory, there are only 3 .jar files, all of them only contain a manifest file. trying to run for example scalac gives:

Error: Could not find or load main class dotty.tools.MainGenericCompiler
Caused by: java.lang.ClassNotFoundException: dotty.tools.MainGenericCompiler

The actual eval line constructed by the scalac script in my case, is:

/usr/lib/jvm/java-21-jetbrains/bin/java" -Xmx768m -Xms768m -classpath "/usr/share/scala3/lib/scala.jar:/usr/share/scala3/lib/with_compiler.jar" -Dscala.expandjavacp=true -Dscala.usejavacp=true -Dscala.home="/usr/share/scala3" dotty.tools.MainGenericCompiler
@rubin55 rubin55 added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 11, 2024
@rubin55
Copy link
Contributor Author

rubin55 commented Nov 11, 2024

Huh. I figured out that, as opposed to LTS (3.3.4), the artifacts contain a maven2 directory, next to the usual bin and lib directory. That maven2 directory seems to contain all the jar archives that would normally end up in lib. The classpath constructed by the scripts look at lib, and don't seem to be maven2 directory-aware. This must be a artifact packaging mistake right?

@WojciechMazur
Copy link
Contributor

maven2 directory was introduced in #20351 for me it seems the expected behaviour. It was part of integrating scala-cli as default runner.

@bishabosha @hamzaremmal @Gedochao opinions?

@bishabosha
Copy link
Member

bishabosha commented Nov 11, 2024

@rubin55 those three jars list the classpath for the commands in the manifest file "Class-Path" attribute - it's necessary for windows on Java 8 where cmd has a limit to the size of a command

@rubin55
Copy link
Contributor Author

rubin55 commented Nov 11, 2024

Ok sure, but the intention can't be that the other command line utilities fail to run right? I suppose the scripts need to be adjusted so they construct a valid classpath or somesuch? Because at least scalac doesn't work like this.

@Gedochao
Copy link
Contributor

Gedochao commented Nov 12, 2024

I downloaded both the zip and tar.gz versions of scala-3.5.2 on the releases page.

Alright, so right there, downloading the artifacts manually is not a recommended way of installation.
@rubin55 You should be able to make things work with power user knowledge, sure.
So perhaps we miss documentation for this case, even if it's not recommended. (cc @hamzaremmal)

However, first things first.
Please refer to https://www.scala-lang.org/download/ and let us know if the recommended ways of installation work for you.
If you run into any issues, please give us more context on your setup.

Ok sure, but the intention can't be that the other command line utilities fail to run right? I suppose the scripts need to be adjusted so they construct a valid classpath or somesuch? Because at least scalac doesn't work like this.

I am suspecting you need to put the jars in the right directories for the scripts to be able to find them. The installer would normally do it for you.

Other than that, is there any reason why you'd download the artifacts manually?

EDIT: I did a quick check, downloaded scala3-3.5.2.zip and unpacked it locally.
Both bin/scala and bin/scalac scripts seem to work as expected.
@rubin55 how exactly did you invoke them to get the ClassNotFoundException?

@Gedochao Gedochao added itype:question area:package-manager area:language installation Issues tied with how the language utilities are installed stat:cannot reproduce and removed stat:needs triage Every issue needs to have an "area" and "itype" label itype:bug labels Nov 12, 2024
@hamzaremmal
Copy link
Member

@rubin55 What's the structure of the /usr/share/scala3 folder ? The paths mentionned stored in the Class-Path attribute are relative and therefore sensible to the layout of the /usr/share/scala3 structure.

@rubin55
Copy link
Contributor Author

rubin55 commented Nov 12, 2024

@Gedochao

image

Second option recommended installation: "Download release from GitHub".

For your information, I've been running Scala like this for years. Also note that 3.3.4, the latest LTS release still works correctly (just have a look at the lib subdirectory of any 3.3.4 artifact to understand why).

@rubin55
Copy link
Contributor Author

rubin55 commented Nov 12, 2024

@hamzaremmal @Gedochao

It's working now. I was using the AUR package which recently updated from LTS to latest; in the PKGBUILD the directories that need to end up in the /usr/share/scala3 directory are explicitly specified and was missing the maven2 directory. Sorry for the noise. TL;DR; downloadable artifacts work, got confused by the empty MANIFEST-only jars in lib, root-cause was missing maven2 directory.

@Gedochao
Copy link
Contributor

Second option recommended installation: "Download release from GitHub".

Right... we do not recommend it on https://www.scala-lang.org/download/, but we do under a specific release, my bad.
We should fix it at some point, installing via a package manager should be considered the default.

TL;DR; downloadable artifacts work, got confused by the empty MANIFEST-only jars in lib, root-cause was missing maven2 directory.

FYI, the changes were introduced in Scala 3.5.0. I'm glad it works.
Seems like there's nothing to do in the scope of this issue, closing this as invalid.

@Gedochao Gedochao closed this as not planned Won't fix, can't repro, duplicate, stale Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants