0

I'd like to use scala project in a closed networks. For this, I've tried to setup my local repository using ivy cache(~/.ivy2/cache) as follow steps.


1. Collecting artifacts from the Ivy cache:

  • Set useCouriser := false and built all of my projects.
  • Copied ~/.ivy2/cache/ to my local repository at /opt/sbt-repo/ivy using the rsync command (rsync -av ~/.ivy2/cache/ /opt/sbt-repo/ivy/).

2. Setting up the ~/.sbt/repositories file:

  • Updated the repositories file with the following content:
    [repositories]
      local
      ivy-repo1: file:///opt/sbt/ivy/
      ivy-repo2: file:///opt/sbt/ivy/, [organization]/[module]/[type]s/[artifact]-[revision].[ext]
    
  • I assumed that [organization]/[module]/[type]s/[artifact]-[revision].[ext] represents the pattern in ~/.ivy2/cache.
  • For example, the artifact https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.17/scala-library-2.12.17.jar is stored in ~/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.17.jar.

However, SBT is unable to find any artifacts. I've referred to the following references, but couldn't find a suitable solution:

I would greatly appreciate any help or guidance to resolve this issue. Thank you!

astrohan
  • 56
  • 7
  • I wouldn't do any of that: in open environment, run SBT commands to build your project, in closed environment copy the `.ivy2` folder from open environment. There might be other folders to copy though. Also why not coursier? – Gaël J Jun 03 '23 at 05:39
  • Sbt use .ivy directory by default, no need to specify it's directly (I don't understand why you changed .sbt/repositories file, I never did it). But you can add some resolvers, including to dir, internal or external host. https://www.scala-sbt.org/1.x/docs/Resolvers.html – Mikhail Ionkin Jun 03 '23 at 12:03

0 Answers0