2

I'm dealing with two repos: - A github repo that contains a bunch of text files. - A scala project that would like to read those text files.

I would like to use SBT to download the contents of the github repo as a build dependency.

I wouldn't mind if SBT supplied either a path (into the ivy repo?) for the project to use or build them into the projects available resources - or any other way that will just work. I'm aiming for something automatic; clearly there are ways I could do this manually.

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
Dave
  • 56
  • 2

1 Answers1

3

If you talk about a bunch of text files like *.property for example that used as dependency for your project (do you really want download them every time?) you may use sbt.IO.download(url: URL, to: File). Just create task and add to project definition compile <<= (compile in Compile) dependsOn myDownloadTask After that you may process them as regular local files ;-).

IMHO you understand that you may add custom logic like caching or page parsing or REST request to GitHub to your project definition. At last you may create your own SBT plugin - there are few video tutorials "How to create SBT plugin in 5 minutes" on YouTube.

Ezhik
  • 876
  • 6
  • 23
  • Thanks for the reply, yes I realised now that that wasn't going to work the way I had in mind. What I really wanted was to get the files downloaded into a local dep repo so that they were a managed dependency and didn't need to be downloaded every time. I've since changed my approach, however, I will look into the sbt plugin idea - I think that might be a good way for the rest of the team to use this - thanks again! – Dave May 28 '13 at 13:25