Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking-in JAR files (libraries) into Version Control tool - Is it a good practice?

I'm developing a web application in Java and I'm using several third party JAR files in my lib folder. I also have Subversion as my version control tool.

My question is, while checking in my project files, should I check-in the JAR files also or is it not needed to version the JAR files as I'm not modifying them anyway?

like image 799
Veera Avatar asked Jan 13 '10 03:01

Veera


People also ask

Are jar files libraries?

A Java Archive, or JAR file, contains all of the various components that make up a self-contained, executable Java application, deployable Java applet or, most commonly, a Java library to which any Java Runtime Environment can link.

What is the purpose of jar tool?

The jar tool combines multiple files into a single JAR archive file. jar is a general-purpose archiving and compression tool, based on ZIP and the ZLIB compression format. However, jar was designed mainly to facilitate the packaging of java applets or applications into a single archive.

What are the advantages of using the jar format?

The JAR File format provides the following benefits. By providing a digital signature in our JAR File, we enhance the security of Java files; as the authorized user who recognize our signature can access the files. It is easy to handle, create, maintain, update, etcetera. so the JAR tool is used to compress the size.


2 Answers

This is a pretty subjective question...I typically apply the following rule of thumb: if I have the code to build a binary, check in the code, and never the binary; if a binary is required to run my code and it comes from an external source, check in the binary.

Note that you'll want to conform to whatever legal conditions might come along with checking in some third party binary to your repository..

like image 167
Mark Elliot Avatar answered Oct 02 '22 15:10

Mark Elliot


I would recommend that wherever possible, you should use Maven. Then you wouldn't need to check third-party JARs into your repository to share them amongst your development team (most of the time).

If you're not already aware, Maven performs two major tasks: build automation and dependency management. Each project has a descriptor file that configures, among other things, which JARs you use as dependencies. The nice thing about that is that Maven will automatically resolve for you the dependencies of those JARs, and their dependencies, and so on.

like image 44
danben Avatar answered Oct 02 '22 15:10

danben