GSON is not being imported into the maven project

前端 未结 4 1449
孤城傲影
孤城傲影 2020-12-06 06:58

I am getting the following error - I have added the GSon in my dependency -

Can someone point out what I am doing wrong?

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-06 07:37

    Try:

    
            com.google.code.gson
            gson
            2.1
            provided
    
    

    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.

提交回复
热议问题