Scala 2.13.x build issue in IntelliJ


#1

I am trying to build scala 2.13.x in IntelliJ by following:

dist/mkBin worked fine.
But when I do project->build, I get many errors, like this one:
Error:(4, 1) java: duplicate class: p1.PackageProtectedJava_1

Am I missing any step here?


#2

The readme could be clearer about this, but did you follow the steps in src/intellij/README.md? (sbt intellij etc)


#4

Try starting fully on the command line with sbt, then import the existing
project from IntelliJ, navigating to the build.sbt and telling IntelliJ
that you want to import an SBT project. You can redo this step again if you
ever have problems, just delete the .idea folder in the project dir.
Basically what seems to work best is if IntelliJ is just tracking SBT and
SBT is in control really always. It will do a good job tracking.


#5

I use the sbt intellij command to generate the ipr project, which I then open in IntelliJ. We have to jump through a few hoops because of the cyclic nature of the build. Last time I checked, IntelliJ could not import the sbt build directly – is it working for you?


#6

Yes sbt import project works great in current paid IntelliJ not sure about
community editions. Isn’t that output IntelliJ project from SBT option
kinda old and not working well?


#7

Good to know, will give it a shot! We use the generated project on a daily basis :slight_smile:


#8

I wonder if we’re all talking about the same thing here. @mghildiy is trying to build Scala itself, in the scala/scala repo. @bentito, I can’t tell in your replies if you’re answering for that repo specifically, if you’re just commenting on your experiences with IntelliJ’s sbt import feature more generally.

@mghildiy questions about building Scala itself are better over at https://contributors.scala-lang.org


#9

Woah missed that. Yeah I don’t think building that in IntelliJ is a good
idea.


#10

Ah, thanks for resolving that misunderstanding, Seth :slight_smile: Although we don’t build the Scala distro with IJ, all daily development by the Scala team (at Lightbend) happens in IJ using the project generated by sbt intellij :wink:


#11

Good to know. I had most experience with it about 18 months ago and it was
often not working for me and others at my work so we adopted the route of
always importing the SBT project.


#12

Following src/intellij/README.md solved the issue.
Thanks for inputs.