How to set up a local proxy repository for SBT?

…衆ロ難τιáo~ 提交于 2019-12-06 01:28:35

问题


I have near zero knowledge of Maven/Ivy but know that these technologies are behind SBT's ability to download and manage libraries automatically.

When I was trying to generate an IntelliJ Idea project from SBT it (Idea or the generator plug-in) has failed to find cached libraries stored in the common Ivy 2 cache. I've solved the problem by setting up the SBT project to use the old scheme storing downloaded libraries under the project directory. Another project of mine uses old SBT version which does it this way by default. In both cases I use clean command to remove library binaries before backing up and update after to download all the libraries again. Which means I download the same library files many times.

The question is how to set up a local repository to cache the libraries so that SBT update will download the libraries from the local cache if available? Would be nice to use the existing ~/.ivy2/cache directory for the cache if possible.

I tend to believe this is probably fairly simple when you have at least basic Ivy 2 knowledge.


回答1:


Ivan, this may help.

sbt
> deliver-local
[info]  delivering ivy file to /.../target/scala-2.9.1/ivy-1.0.xml

Then, you'll need to find IntelliJ equivalent steps, but in Eclipse you configure the build path with an additional library, "IvyDE Managed Dependencies" offered by the IvyDE plugin

1) browse to the target/scala-version/ivy-1.0.xml file
2) select desired configurations (compile, runtime, test, provided, etc.)

Now you have an ivy representation of your sbt configuration.

This works wonderfully with one annoying exception: on "sbt clean", ivy config file gets blown away and you have to repeat the above. Eclipse project clean preserves ivy config, btw.

Keep posted if this approach can be applied to IntelliJ



来源:https://stackoverflow.com/questions/9832710/how-to-set-up-a-local-proxy-repository-for-sbt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!