Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I must have a big blank in my knowledge of Maven, because I run into this problem on a regular basis...

I want to use Gson library ( https://code.google.com/p/google-gson/ ) in my project. I added the following dependency to my pom.xml, as per the project's homepage:

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.3</version>
</dependency>

That's nice. However, the dependency is not found by Eclipse. And that kinda makes sense. Where would it look for it? Which repository? I have a number of repositories declared in the pom.xml, but maybe none of them contain Gson.

And this is really a general question. I'd say most projects I've seen so far do not say which repository the artifact is stored in. They only provide the XML element for the dependency. What am I missing here? Does the main Maven repo contain all artifacts ever released by anyone? Please help me understand why so many projects do not say which repository their artifacts are stored in.

And if you could also tell me where do I find Gson artifact - I'd greatly appreciate it.

Note to close voters, this question is asking for the official location of a specific resource provided by Google; it is not a request for tool or resource recommendations. – TylerH Apr 10 at 13:48

Maven searches by default for artifacts in Maven Central.

I can find this artifact in Maven Central: http://search.maven.org/#artifactdetails%7Ccom.google.code.gson%7Cgson%7C2.3%7Cjar

In your settings.xml you tell maven which are the repos you wanna search in, if you have "special" repos. There, you can configure username/passwords for these repos in case you need to upload JARs to your repo.

So if your maven cannot find it, paste here your settings.xml - maybe it is misconfigured.

BTW: does this help? GSON is not being imported into the maven pproject

When I search for Gson, I can find many artifacts. How do I know which one should I pick? – Line May 15, 2017 at 13:29 where do you make this search? if you search Mavencentral, and you specify the group name and artifact name, you get a single result (with all its versions) – OhadR May 16, 2017 at 5:22 In Maven Central. But the thing is I don't know group name. I just know that I want to use Gson - how to recognize which group name is good? – Line May 16, 2017 at 6:33 as i wrote in my answer, the groupId='com.google.code.gson'. most of all gson's are similar, not to say identical... – OhadR May 16, 2017 at 7:28 originally, gson was presented by google. so the "original" version is google's, com.google.code. – OhadR May 16, 2017 at 8:20

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.