GSON is not being imported into the maven project

Try:

<dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
</dependency>

I have edited my comment and added the scope. The default scope is compile, meaning that the dependency is not present at runtime. For this, you use the provided scope. More about scopes in maven dependencies on Apache’s Introduction to Maven Dependencies.

Hope this resolves your issue.

P.S.: if you are creating your own repository, you should also take a look here.

Leave a Comment