java - GSON is not being imported into the maven pproject -


I get the following error - I've added the GSO in my dependency -

Can I talk about what I am doing wrong?

Enter image details here

Edit: Specified dependencies -

  & lt; Dependency & gt; & Lt; Group & gt; Com.google.code.gson & lt; / Group & gt; & Lt; ArtifactId & gt; Gson & lt; / ArtifactId> & Lt; Version & gt; 1.7.1 & lt; / Edition & gt; & Lt; / Dependencies & gt;   

I am using the following code in my service -

  JSONService json = new JSONService (); String json_output = json.makeLoginJSON (user);   

McGuinJSON ---

  public string menologieJSON (login user) {string finals Jason = null; Gsan gsn = new gsan (); FinalJason = GSN Tojson (user); Return to the Last Jason; }    

Try:

  & lt; Dependency & gt; & Lt; Group & gt; Com.google.code.gson & lt; / Group & gt; & Lt; ArtifactId & gt; Gson & lt; / ArtifactId> & Lt; Version & gt; 2.1 & lt; / Edition & gt; & Lt; Scope & gt; Provided & lt; / Scope & gt; & Lt; / Dependencies & gt;   

I have edited my comment and added the scope to the default area compile , which means that dependency is not present at runtime, for that you < Em> use the provided field

Hope this resolves your problem.

PS: If you are making your own reservoir, then you should also take a look.

Comments