17

Should be simple question.

When I go to https://github.com/google/gson I can only download the library as a zip folder as opposed to a jar file.

Where can I get the jar file?

user1081679
  • 307
  • 1
  • 2
  • 15

4 Answers4

13

First you need to clone the repository locally on your computer:

git clone https://github.com/google/gson

Then you go inside the project folder ./gson and you create the jar file running:

mvn package

Of course to do this you need to have maven installed, if you are under osx you can install it running

brew install maven

Otherwise you can look for the installation for your system on the maven official website

After running mvn package the jar file will be in ./gson/gson/target/gson-2.7.1-SNAPSHOT.jar

Stram
  • 796
  • 10
  • 17
  • I am running Elementary OS by the way. Got this error after running 'mvn package' http://pastebin.com/tXFS24nH – user1081679 Jun 22 '16 at 19:32
  • try to install it with sudo apt-get purge maven maven2 maven3 sudo apt-add-repository ppa:andrei-pozolotin/maven3 sudo apt-get update sudo apt-get install maven3 as explained [here](http://robferguson.org/2016/03/29/how-to-install-git-maven-and-eclipse-on-elementary-os/) – Stram Jun 22 '16 at 19:34
  • Thank you for sorting that for me! One final question; I'm now getting this error http://pastebin.com/EHTK5p9Z How can I run my program? The command line seems to think my .java file is in the package – user1081679 Jun 22 '16 at 21:47
  • 6
    Amazing the amount of work needed to do to download a simple jar file. Is there a link to the jar file? – TatiOverflow Nov 30 '16 at 21:17
  • 2
    yes, the readme of the repository points here http://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.0/ – Stram Nov 30 '16 at 22:37
  • Here: https://repo1.maven.org/maven2/com/google/code/gson/gson/2.10.1/ replace the version name with the desired version. – rahimv Jan 18 '23 at 14:31
8

There is a MVN Repo http://mvnrepository.com/ there you will find how to add to a maven OR in your case how to download the lib jars

enter image description here

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
3

am bit late but for anyone in future, https://mvnrepository.com/artifact/com.google.code.gson/gson/2.8.0

ofcourse if its vresion changes you can figure it out from the base url.

mcamocci
  • 56
  • 1
  • 4
2

I just downloaded it here:

https://jar-download.com/explore-java-source-code.php?a=gson&g=com.google.code.gson&v=2.7&downloadable=1

Is working for me.

Martin Meeser
  • 2,784
  • 2
  • 28
  • 41
  • 8
    It's usually more advisable, namely because of security, to download libraries from official sources: https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.2/ – jmng Dec 28 '17 at 18:08