Confused about sbt, ivy, maven and download locations

Hi all,

I've put up with something for a long time and I want to get to the bottom of it.

When I compile a new scala project on the command line using sbt (in this case Finatra but also Play), the system initially takes some considerable time to identify and download the required new modules. That's fine.

I then import the project into IDEA (as an sbt project) - and it then spends ages downloading what seem to be the same modules. It seemed even to download scala this time too.

I'm confused. How can I set up IDEA to point to exactly the same repository locations? The test is "if it's compiled and run once in the console, it should be near instant in the IDE too".

Thanks
Ellers

1 comment
Comment actions Permalink

Hi,

You don't need to point locations or set up IDEA in some other way. We're using SBT under the hood, so all artifacts are downloaded and processed by SBT itself. However, there are some things that could have impact on import time in IDEA.

First, it heavily depends on whether do you choose to download sources and javadocs or not. SBT needs only binaries to compile your project; in IDEA, on the other hand, you might want to have source of your dependencies as well in order to enhance completion, resolving, etc. Downloading sources and javadocs could increase import time from 2x to 10x depending on how many of them needs to be downloaded and what their sizes are. Their retrieval is probably the reason why you think that IDEA downloads Scala sometimes, when in reality it downloads Scala sources.

Second, there is a performance issue on really big projects (100+ subprojects) that are heavily inter-dependent. You shouldn't notice that unless you have a really huge project. Good news is that fix for that issue is on review and soon will be merged and released.

Third, only one instance of SBT may access Ivy's cache at particular moment of time. So if you start new SBT repl somewhere else, even on a completely different project and then try to compile or test it, it might slow down the process for both projects because they will spend a lot of time switching back and forth on Ivy's cache file locks.

I hope it will answer your question. If you still think that IDEA works considerably slower than SBT on your project, please create new ticket in our issue tracker following this guide.

0

Please sign in to leave a comment.