How do I download the Gson library? - github

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?

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

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

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.

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.

Related

Import org.apache.chemistry cannot be resolved, but library is already in build path?

Eclipse can't seem to locate org.apache.chemistry.opencmis.chemistry-opencmis-osgi-client_x.y.z.jar. I've tried adding it to every possible location. What am I missing?
It's not mentioned in pom.xml, but that shouldn't be required according to the tutorial I'm following.
From you screenshot I can see that you already have Maven, because I see your pom.xml file. If you have Maven please install this dependency manually.
Maybe this like can help you How to add a local jar in maven
I would add this dependency in POM and install this JAR manually. If your company has a Nexus, I would later upload it there.

Build KafkaOffsetMonitor tool manually

I am trying to monitor kafka using KafkaOffsetMonitor tool. It is working fine as I used already built jar available at its github page. Now I want to make some changes in this tool but I dont know how to manually build it. I have downloaded the zip file from github page. Now how should I build it?
PS: Steps would be helpful
Below are the steps which may help you:
1. Checkout and get the source code into your local machine or you may have to unzip it if you have downloaded zip file.
2. Go to the folder which you have extracted or checked-out.
3. Run below command:
mvn clean package -U -DskipTests
Note: make sure you have installed maven in your machine.
Make the changes in the source if you want to modify the tool and build it using above steps.
I know that I'm coming at this pretty late, but I ran into the same problem. Basically, you need a Java jdk, scala, and sbt installed first. You didn't post what os you're dealing with, so it would be hard for me to give you steps for that. I use Gentoo Linux and you can install it by running emerge -av sbt
Once sbt is installed, just clone KafkaOffsetMonitor Github repository change to the top level directory and run the following sbt command: sbt assembly
The jar you will be looking for will be in: ./target/scala-<scala_version>/KafkaOffsetMonitor-assembly-<kafkaoffsetmonitor_version>.jar

Maven dependency Hibernate library cannot be read

I'm getting the following error in eclipse.
Archive for required library: '~/.m2/repository/org/hibernate/hibernate-core/4.2.1.Final/hibernate-core-4.2.1.Final.jar' in project
I've done Maven->Update Project and still it can't recognize the library.
I've verified that the jar file exists in the location mentioned.
This post has the same error as I do but I double checked my pom and there are no duplicates.
Check access settings for file '~/.m2/repository/org/hibernate/hibernate-core/4.2.1.Final/hibernate-core-4.2.1.Final.jar' if you are using *nix system,
Also make sure you can open hibernate-core-4.2.1.Final.jar archive using third party tools e.g. 7zip or winrar. from my experience many times maven in eclipse does not properly download dependency and downloaded jar is corrupted. If that is the case you can manually download this jar and replace it in .m2 repository.
Try to run maven task eclipse:eclipse from command prompt
open command prompt, Change Directory to project root directory and type
mvn eclipse:eclipse
And go back to eclipse and refresh project and see will it works :)

Where do Maven look for springMVC jars when working with eclipse(maven plugin installed)

I am using m2e plugin.
Just stuck at one point when maven search for springMVC jar files where it would be searching.
In /web-inf/lib or in project build path.
Where should I put those jars
Thanks
Maven looks for jars in its repositories.
Therefore you don't need download jars manually when using Maven, it will automatically download jars from remote repository and put it to the local repository on your machine.
Maven uses "settings.xml" file to find out your project repositories. and resolve dependencies(every jar files that you need) from those repositories.
more about seetings.xml and also
this one .
After downloading required jar file for first time, maven puts it in your local repository in:
${user-home}/.m2/repository.

Setting up apache solr in eclipse

I am trying to set up Solr in eclipse by following the instructions here: http://hokiesuns.blogspot.com/2010/01/setting-up-apache-solr-in-eclipse.html.
The distribution of Solr that I downloaded does not have WEB-INF directory. I have added the jars that I found in lib to build path. However I get invalid run configuration error.
Can anyone who has Solr set up in eclipse please confirm their settings and configurations.
here's something that might help from a quick googling: In this sort of configuration Maven proves a life savior. Looking for a maven archetype (predefined project structure) I've found this. So in an empty dir try to run the mvn archetype:generate command they are quoting and finally if you are using eclipse run mvn eclipse:eclipse for the eclipse specific files so you can do Import > Existing Maven Projects from eclipse.
The problem was that I had not extracted the war.
As Jem pointed out , the .war exists in dist directory. However dist directory itself doesnt exists in the downloaded source :).
You need to do
ant dist
in the apache folder to get this.
Hope that helps someone else. I was able to get solr up and running using the command line as well as eclipse.
Check the .war file in dist. It has a WEB-INF directory.
So extract the war file and use the files in the lib directory.
For this example I had to make a "classes" directory in WEB-INF