Why SBT custom plugin resolution is slow - scala

I have my custom SBT plugin and I use it in my project. In case of any change of the plugin I make publish-local and then I build my project and sbt writes in console Resolving <my-plugin-name>;0.2-SNAPSHOT .... This resolution takes long time(about minute).
Why it takes so much time to resolve a custom sbt plugin from local repository and how to fix this ?
Update
Please note, that I have slow network connection via proxy-server. So probably it's the issue. But in this case I wonder why sbt needs network if I have my plugin published-local. And if it's the issue how to eliminate network round trip ?

If the dependency is a SNAPSHOT, then sbt will try to resolve it from the remote repository in case it has been updated.
See also Re-download a SNAPSHOT version of a dependency using SBT

Related

Prevent the download of Gradle and Maven dependencies

Before asking my question I'd like to apologize if this is really a
simple question.
I'm trying to find out the way, where we can locate and reuse the dependencies of Gradle and Maven. I want to find the possibilities of reusing them within multiple projects at the same time, opened in STS, Eclipse or Intellij.
Instead of download them every time when we create a new project. It will save me the data, time and disk space.
Maven dependencies are not downloaded again every time you create a new project.
They are downloaded to the local repository of your computer once and then they are read from there. So as long as you open a new project on the same account, Maven does not redownload dependencies.
The exception are SNAPSHOT dependencies, for which Maven periodically looks for new updates in the remote repositories.
Gradle, like Maven, has an Offline Mode, which means you're telling it to always try to re-use cached dependencies instead of resolving them from network.
Each of the dependency manager has a command line option for this, but in IntelliJ IDEA you can enable/disable it simply by toggling an icon-button in the Gradle toolbar.
And the same for Maven.

Publishing / Resolving Custom SBT Plugins with Nexus

I've created my first SBT (1.x) AutoPlugin to add some settings and behavior to projects that use the plugin.
When I publish it locally, everything resolves and works correctly for the projects using the plugin.
However, when I publish the plugin to our private Nexus repository, it fails to resolve for any projects attempting to use it.
I realize that when sbt plugins are published locally, the path is different than 'regular' sbt projects, but they still resolve correctly for projects which use them.
Do I need to publish sbt plugins to a different location within Nexus than our other Scala / SBT-based projects?
And / or, do I need to set up a new resolver for Nexus-hosted SBT plugins?
I know similar questions have been asked previously, but being new to both Nexus and plugin creation, I haven't been able to figure out exactly what I need to do to get the plugin to resolve correctly when publishing to Nexus rather than simply doing a publishLocal and then adding it to the plugins.sbt file of projects meant to use the plugin.
Any assistance would be very much appreciated!

SBT disable ivy lock

I'm new at scala and sbt so my question may sound silly.
So I have complex play/scala project. Compilation can take 15-25mins (I'm running only one sbt instance).
I've used this https://github.com/jrudolph/sbt-optimizer plugin to recognize the root of the issue.
I found that ivy lock takes lots of time:
So I've googled about ivy and found some info about ivy locks.
Then I found similar issues at SO How to configure Ivy's lock strategy in Sbt but this doesn't help me (build time is the same).
So I want to speed up project build time, so I suppose I need some how change ivy lock strategy. How I can do this?
Or maybe you have some ideas how to speed up build?
You can use the coursier plugin. It removes the ivy lock and can download your artifacts in parallel.

Why it took so long to download sbt dependencies when I create a scala project in intellij idea?

I am new to scala, when I create a scala project in intellij it took really so long to download all the jar files. I have installed the scala plugin for idea IDE. Could anyone please tell me what should I do to get on the right track? Thanks very much.
Since the scala language is really a library on top of the JVM, creating a scala project for the first time requires the download of the specified scala version from a maven repository (usually this is at least the compiler and library, which for 2.10 comes to ~20MB). This will happen the first time, even if you've installed that same version of scala on your machine outside of sbt.
Once you go through this the first time, though, the next project you create--whether via sbt on the command line or via an IntelliJ sbt project--will pull these dependencies from your local ivy cache instead.
However, should you change the language version in your project, it will once again have to download the full language dependencies for that version.
In the screenshot it try to download the source files of one of of the dependencies. That mean it will try to download not only the compiled jars, but also it's source and docs.
only after downloading all of them, the project will be ready.
Disable to downloading of the sources and docs, and it will be much faster. How to disable it depends on how you create the project. (eg if you create sbt project, make sure to uncheck the "download sources and docs" in the creation/import wizard)

How to proxy a static snapshot of scala 2.10.3

Scala 2.10.3 has a bug fix my team needs; but, I don't want to subject my group to a constantly changing version (using 2.10.3-SNAPSHOT). How can I download the latest snapshot, publish it to my local nexus (say 2.10.3-FOO) and have sbt use it? I'm familiar with proxy-ing and did get sbt to use our nexus repository to download the renamed scala-lang, scala-compiler. However, it never downloads scala-reflect and bombs out. What am I missing?
I found that pulling down scala.git and publishing a local build to our nexus repo using the ant tasks provided allowed me to accomplish what I was after. In terms of sbt, the documented way of using a proxy repo (-Dsbt.override.build.repos=true, using the repositories file) worked well.