Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Play Framework store libraries?

I am trying out the Play Framework 2.3.2 using the offline installation with Typesafe Activator 1.2.3 on Mac OS X 10.9.4.

In the activator-1.2.3 folder I unzipped there is a repository folder that looks similar to my ~/.ivy2/cache folder, in that it contains folders for... libraries? Bundles? I don't know the terminology.

Now, as far as my understanding goes, Activator uses SBT and SBT uses Ivy for dependency management. Ivy is something like Maven, it even uses its repositories.

My question are these:

  • If I open a Play Framework project and Activator downloads all the dependencies, what is exactly happening?
  • Is there a different process when I start building the project?
  • Where do the libraries (bundles?) get downloaded to?
  • Is activator-1.2.3/repository folder something like a bootstrap, and all the other dependencies go to ~/.ivy2?
  • What if I had Maven installed and there was a ~/.m2 folder?

So you see I am completely lost in this. Any insights are very much welcome.

like image 305
vektor Avatar asked Aug 02 '14 09:08

vektor


1 Answers

Since 2.3.x Play is distributed as an Activator distribution that contains all Play’s dependencies to follow sbt's rules, i.e. dependencies/libraries built locally go to ~/.ivy2/local while the cache of downloaded dependencies/libraries is under ~/.ivy2/cache.

And later in the What’s new in Play 2.3 document:

Default ivy cache and local repository

Play now uses the default ivy cache and repository, in the .ivy2 folder in the users home directory.

This means Play will now integrate better with other sbt builds, not requiring artifacts to be cached multiple times, and allowing the sharing of locally published artifacts.

When you update (and hence compile or run) a Play 2.3.x project, the dependencies go to ~/.ivy2/cache.

What's under activator-1.2.3/repository appears a local Ivy2 repository to speed up resolving dependencies that otherwise would've been downloaded from online repositories.

Dependencies under ~/.m2 have to be added explicitly as described in Library dependencies and Resolvers in the official documentation of sbt.

You may find fullResolvers task useful to learn about the available resolvers/repositories.

[jacoco4sbt-play] $ help fullResolvers
Combines the project resolver, default resolvers, and user-defined resolvers.
[jacoco4sbt-play] $ show fullResolvers
[info] ArrayBuffer(Raw(ProjectResolver(inter-project, mapped: )), FileRepository(local,FileConfiguration(true,None),Patterns(ivyPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), artifactPatterns=List(${ivy.home}/local/[organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false)), public: http://repo1.maven.org/maven2/, Typesafe Releases Repository: http://repo.typesafe.com/typesafe/releases/)
[success] Total time: 0 s, completed Sep 23, 2014 11:02:19 PM
like image 134
Jacek Laskowski Avatar answered Oct 29 '22 18:10

Jacek Laskowski