-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
Error in IntelliJ about Multiple 'scala3-library*.jar' files when using scala 3.x and scalajs #3344
Comments
Thank you for this report. We introduced the "scala-SDK" entry in Mill |
I just checked your example project.
I think the But the compiler classpath that Mill uses looks at a first glance identical to the one in the So the question is, who is wrong? Obviously Mill compiles successfully. So is IntelliJ reporting false here or should the classpath indeed contain less entries? @lolgab, WDYT, anything redundant or too much here? |
From looking at the <component name="libraryTable">
<library name="scala-SDK-3.3.1" type="Scala">
<properties>
<language-level>Scala_3_3</language-level>
<compiler-classpath>
<!-- -->
</compiler-classpath>
</properties>
</library>
</component> @unkarjedy, do you have any insights? |
There is no any ScalaJS specific library type. Scala Plugin has the best support for SBT projects. To fix this particular issue, just don't add Scala JS specific jars to the compiler classpath. |
@unkarjedy Thank you! Does that also mean, IntelliJ isn't using any JS runtime to run tests? |
Ok, I'll try with bsp and report back
In the meantime, if mill stops adding scalajs jars to the class path (" just don't add Scala JS specific jars to the compiler classpath") then how will it be possible to build code that uses any browser apis?
…---
Sent with Superhuman ( https://superhuman.com/refer/cmsqjaxn ). Please favor brief email ( http://three.sentenc.es/ ) over chat, especially for tasks. For chat (+1-415-235-0687), WhatsApp is best. Never Signal unless there are legal issues.
On Wed, Aug 07, 2024 at 3:48 AM, Tobias Roeser < ***@***.*** > wrote:
@ unkarjedy ( https://github.com/unkarjedy ) Thank you! Does that also
mean, IntelliJ isn't using any JS runtime to run tests?
—
Reply to this email directly, view it on GitHub (
#3344 (comment) ) ,
or unsubscribe (
https://github.com/notifications/unsubscribe-auth/AAAOIXL6OMBHHSWFMQSCNFLZQH3OLAVCNFSM6AAAAABMDUTUGCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZTGE3TQNRXHA
).
You are receiving this because you authored the thread. Message ID: <com-lihaoyi/mill/issues/3344/2273178678
@ github. com>
|
Would be nice if someone with sbt experience can prepare a sample project. |
I tried with bsp with these steps:
IJ compiles everything fine but I remembered why I don't like using bsp: it only shows compilation errors (or removes them when they are fixed) when I manually compile. Using GenIdea I get immediate feedback on errors. Unless there's a fix for this, I'd love to get GenIdea working Also, my real project uses Mill (0.11.8, but I think that it works with 0.11.11 too), Scala 3.3.1 and ScalaJS 1.6.0, and even has a module that's shared between the JS and JVM builds. It works great (after a lot of trouble figuring out how to do the shared module). So GenIdea can work even with Scala 3.x. The problems started when I tried to upgrade to Scala 3.4. Pairing things back to find the source of the error led to this. I don't yet understand why my real project works with Scala 3.3.1 when this one does not |
Yes |
I've updated my demo repo to Mill 0.11.12 and get the same error as before. Is that expected? I can't tell whether #3345 was meant to fix all of this |
Strangely, my real project uses mill 0.11.8 and a mixture of ScalaJs and regular Scala, and builds fine, both in mill and in IntelliJ (using GenIdea to make the project). But upgrading to 0.11.12 gets me the same problems that my example project demonstrates |
With mill version 0.11.12 - 0.12.0-RC2 the example project [mill-scalajs-experiment] compiles in IntelliJ IDEA 2024.2.3 (Ultimate Edition) by removing the scala-library from scala_js_SDK. mill -j 0 mill.idea.GenIdea/idea; sed -i '/scala3-library_3/d' .idea/libraries/scala_js_SDK_*.xml |
So, you mean removing the |
Although I think IDEA is misbehaving, if this solves the issue, I can implement this specific logic. |
Only scala3-library. |
IntelliJ IDEA doesn't have proper Scala.JS support but complains about multiple Scala library jars on the compiler classpath. Users reported that removing the scala3-library_3 fixes the issue. This PR applies this to `GenIdea`. Hopefully fix com-lihaoyi#3344
Thank you! I can confirm that this fixed my real project, in addition to the sample that I linked to. (And sorry about the slow reply. I had to figure out some path issues caused by one of the other changes between 0.11.11 and 0.12-M3.) |
When I use GenIdea in a mill/scalajs project and then build in intellij, it works fine if build.sc uses scala 2.13.14 but for every version of scala 3 that I have tried IJ gives me errors of the form
scala: Multiple 'scala3-library*.jar' files (scala3-library_3-3.3.1.jar, scala3-library_sjs1_3-3.3.1.jar) in Scala compiler classpath in Scala SDK scala-SDK-3.3.1
https://github.com/malcolmredheron/mill-scalajs-experiment contains code and exact steps that demonstrate the problem. This happens for me with mill 0.11.8, 0.11.10, 0.11.11 and 0.11.11-1-066ea7, which is the most recent commit that I could find a build for
The text was updated successfully, but these errors were encountered: