Is it a bad idea to put a jar file in the vendor/ directory and add it to the git repo?
I have a Rails 3 project that uses some java 开发者_Python百科jar files. I'm putting these jars in the vendor/ directory and adding them to the git repo.
But these jars can be large (e.g. 22MB), and they are binaries. On the other hand, it's convenient to store them into the repo with the Ruby code since they work closely with the rest of the app.
What's the best practice on Java jars, git repositories, and the Rails vendor directory?
You are opening a big can of worms regarding dependency management. Most projects including some of the smaller ones I work on use the ball of mud, dependencies in a folder approach. As the project gets larger somebody serious comes along and typically does a 'proper' dependency management with Ant+Ivy or Maven for Java projects. Depending on how often your binaries change you may get away with storing them in version control.
In my opinion if your app requires them to run then it makes sense to keep them in the git repo otherwise if you checked out the app on another machine you'd have to mess around sourcing the binaries again. 22MB isn't that huge and they aren't going to be modified, so I don't think this causes any problems.
精彩评论