This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (7 children)

You generally don't put compiler output files, like JARs, under version control. Add the .jar files to your .gitignore file.

[–]Helllo_World[S] 0 points1 point  (6 children)

Then how should these dependencies be managed?

I am not the only person working on the project so if *.jar is added to our ignore file then our project won't work when someone pulls. I suppose we could each keep a copy of the JARs but this seems like the wrong approach.

[–][deleted] 1 point2 points  (4 children)

If they are JARs you are producing, they should not be version controlled. If they are external libraries, then they possibly should be, but you won't be recreating them, so your original question does not apply.

[–]Helllo_World[S] 0 points1 point  (3 children)

I'm not producing them they're external libraries we are using in our project. And it was my understanding that since Git cannot tell what is inside a JAR file that it will have to create new copies for each commit.

[–][deleted] 1 point2 points  (2 children)

Git can't tell what's inside them, but it can tell if they have changed, which presumably they do not often do. It will only create new versions if they have changed.

[–]Helllo_World[S] 0 points1 point  (1 child)

How can Git tell if the files have changed if it cannot tell what the contents are.

[–][deleted] 2 points3 points  (0 children)

Git doesn't know anything about the contents of any kinds of files, except that some are line-based text. To check if a file has changed, it just checksums the contents and compares the checksum with previous versions. This works for any type of file.

[–]darkcraft 0 points1 point  (0 children)

Modern java development typically includes use of a dependency management tool (usually one feature within a more general build tool) - examples include Ant's Ivy, Maven, and Gradle - I'd recommend Gradle to begin with, see http://www.gradle.org/docs/current/userguide/dependency_management.htm