Just an explanation in Raoulβs answer - itβs good that it works for you, but is provided for dependencies that are expected to be available from the JRE / JDK, i.e. servlet classes. Compilation is by default and should work in cases of other people, since gson is not accessible from the JRE, instead it must be loaded by maven. From http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope :
compilation This is the default area that is used if none are specified. Compilation dependencies are available in all classes of the project. In addition, these dependencies apply to dependent projects.
provided This is very similar to compilation, but indicates that you expect the JDK or container to provide a dependency at runtime. For example, when creating a web application for Java Enterprise Edition, you must make a dependency on the Servlet API and its associated Java EE APIs for scope because the web container provides these classes. This scope is accessible only on the way to compilation and testing and is not transitive.
at run time This area indicates that the dependency is not required to compile, but is intended to be executed. It is in the runtime and tests class paths, but does not compile class paths.
test This area indicates that the dependency is not required for normal use of the application and is available only for the compilation and execution phases of the tests.
system This scope is the same as provided, except that you must provide a JAR that contains it explicitly. The artifact is always available and cannot be viewed in the repository.
import (available only in Maven 2.0.9 or later) This scope is used only depending on the type of pom in this section. It indicates that the specified POM should be replaced by the dependencies in this POM section. Since they are replaced, dependencies with the import region do not actually participate in limiting the transitivity of the dependency.
source share