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

Answer from OhadR on Stack Overflow
🌐
Maven Repository
mvnrepository.com › artifact › com.google.code.gson › gson
Maven Repository: com.google.code.gson » gson
September 10, 2025 - Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. ... aar android apache api arm assets build build-system bundle client clojure cloud config cran data database eclipse example ...

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

Answer from OhadR on Stack Overflow
🌐
GitHub
github.com › google › gson
GitHub - google/gson: A Java serialization/deserialization library to convert Java Objects into JSON and back · GitHub
Gson jar downloads are available from Maven Central.
Starred by 24.3K users
Forked by 4.4K users
Languages   Java
🌐
Maven Central
central.sonatype.com › artifact › com.google.code.gson › gson
Maven Central - com.google.code.gson - Sonatype
--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.google.code.gson</groupId> <artifactId>gson-parent</artifactId> <version>2.13.2</version> </parent> <artifactId>gson</artifactId> <name>Gson</name> <licenses> <license> <name>Apache-2.0</name> <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> </license> </licenses> <properties> <!-- Make the build reproducible, see root `pom.x
🌐
Maven Repository
mvnrepository.com › artifact › com.google.gson
Maven Repository: com.google.gson
aar android apache api arm assets build build-system bundle client clojure cloud config cran data database eclipse example extension framework github gradle groovy io ios javascript jvm kotlin library logging maven mobile module npm osgi persistence plugin resources rlang sdk server service ...
Find elsewhere
🌐
Jenkov
jenkov.com › tutorials › java-json › gson-installation.html
GSON - Installation
June 13, 2015 - To use GSON in your Java application you need to include the GSON JAR file in the classpath of your Java application. You can do so either by adding GSON as a Maven dependency to your project, or by downloading the JAR file and include it in the classpath manually.
🌐
Maven Central
central.sonatype.com › artifact › com.google.code.gson › gson › 2.9.0
com.google.code.gson:gson:2.9.0 - Maven Central
<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.9.0</version> </dependency> Copy to clipboard · <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.google.code.gson</groupId> <artifactId>gson-parent</artifactId> <version>2.9.0</version> </parent> <artifactId>gson</artifactId> <name>Gson</name> <licenses> <license> <name>Apache-2.0</name> <url>h
🌐
Sonatype OSS Index
ossindex.sonatype.org › maven › com.google.code.gson/gson
Maven - com.google.code.gson/gson - Sonatype OSS Index
com.google.code.gson · https://search.maven.org/artifact/com.google.code.gson/gson · Report advisory or correction · Google Gson library · 1 high · 1 medium · Detailed component information including: Version history · Declared licenses ·
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 206813395-using-gson
using gson – IDEs Support (IntelliJ Platform) | JetBrains
September 17, 2015 - For anyone in the future still ... on, on the far right you should see a '+'. Since Gson has a Maven repository, go to Library -> From Maven......
🌐
GitHub
github.com › google › gson › blob › main › UserGuide.md
gson/UserGuide.md at main · google/gson
To use Gson with Maven2/3, you can use the Gson version available in Maven Central by adding the following dependency:
Author   google
🌐
Reddit
reddit.com › r/learnjava › not able to use gson in my project (maven + vscode studio)
r/learnjava on Reddit: Not able to use GSON in my project (Maven + VSCode Studio)
July 5, 2024 -

Whenever I work on a project using Maven on VSC, I always get "[module name] cannot be resolved to a module". For example, in my project made using the JavaFX Template, only JavaFX works and when I try to load gson it does not work. It does not allow me to import or require any new dependency. This is when I add new dependencies through VSCs inbuilt add maven dependencies function.

My module-info.java

module com.example {
    requires javafx.controls;
    requires javafx.fxml;

    opens com.example.controllers to javafx.fxml;

    exports com.example;
    exports com.example.controllers; 
}

My pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>maron</artifactId>
    <version>1</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
    </properties>
    <dependencies>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.11.0</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>13</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>13</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.6</version>
                <executions>
                    <execution>
                        <!-- Default configuration for running -->
                        <!-- Usage: mvn clean javafx:run -->
                        <id>default-cli</id>
                        <configuration>
                            <mainClass>com.example.App</mainClass>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

I tried mvn clean install but it still does not work. I also updated maven too.

Top answer
1 of 2
1
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full - best also formatted as code block You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2 of 2
1
What do you mean by "It does not allow me to import or require any new dependency"? It's hard to say what the problem could be, but I would expect to see "requires com.google.gson" in your module-info.java.
🌐
Reddit
reddit.com › r/askprogramming › running java maven project from terminal with gson depedency
r/AskProgramming on Reddit: Running Java Maven Project From Terminal With Gson Depedency
February 27, 2019 -

I've always had trouble running my maven projects that use Gson in the cmd line / terminal getting errors at runtime like:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gson/Gson

at controllers.CourseSchedulerController.findCorrectOrder(CourseSchedulerController.java:28)

at Scheduler.main(Scheduler.java:13)

I suppose IDEs like IntelliJ handle dependencies for you but there should be a way to add this dependency when I run from terminal right? These are the commands i'm running:

mvn clean install

mvn compile

mvn clean package

java -cp target/course_scheduler-1.0-SNAPSHOT.jar Scheduler

🌐
Atlassian Developer Community
community.developer.atlassian.com › confluence development › confluence data center
Com.google.code.gson:gson is a banned dependency - Confluence Data Center - The Atlassian Developer Community
April 4, 2024 - Hello! Working on 8.9 compatibility (and preparing for 9.0 compatibility), I updated to AMPS 8.15.0, go to build, and: [WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message: make sure platform artifacts are not bundled into plugin Found Banned Dependency: com.google.code.gson:gson:jar:2.10.1 Use 'mvn dependency:tree' to locate the source of banned dependencies.
🌐
Maven Central
repo.maven.apache.org › maven2 › com › google › code › gson › gson-parent › 2.11.0 › gson-parent-2.11.0.pom
https://repo.maven.apache.org/maven2/com/google/code/ ...
spotless-maven-plugin · 2.43.0 · check · *.md · *.xml · .github/**/*.yml · .gitignore · true · 2 · src/test/java/com/google/gson/functional/Java17RecordTest.java · src/test/java/com/google/gson/native_test/Java17RecordReflectionTest.java · true · true ·
🌐
Maven Central
central.sonatype.com › artifact › com.google.http-client › google-http-client-gson › 1.42.3
google-http-client-gson - Maven Central
<dependency> <groupId>com.google.http-client</groupId> <artifactId>google-http-client-gson</artifactId> <version>1.42.3</version> </dependency> ... <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.google.http-client</groupId> <artifactId>google-http-client-parent</artifactId> <version>1.42.3</version><!-- {x-version-update:google-http-client-parent:current} --> <relativePath>../pom.xm
🌐
GitHub
github.com › google › gson › releases
Releases · google/gson
September 10, 2025 - Made Maven build reproducible (@Marcono1234, #2543) Removed internal DateTypeAdapter class to reduce code duplication (@Marcono1234, #2546) ... GitHub Discussions have been enabled For questions, ideas, tips... Added GitHub pull request template (@Marcono1234, #2326) Added check for Android API compatibility (@Marcono1234, #2431) Added @CanIgnoreReturnValue as appropriate to Gson methods (@eamonnmcmanus, #2369) This is useful if you enable Error Prone's CheckReturnValue in your project when compiling, however Gson itself does not enable this by default.
Author   google
🌐
Cs1302uga
cs1302uga.github.io › cs1302-book › java › json › gson.html
15.5. Adding Gson to a Project - CSCI 1302
To use Gson in a Maven project, Gson must be added as a dependency in the project’s pom.xml file — refer to the Dependency Management section in Maven’s documentation for more information:
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-install-gson-module-in-java
How to Install GSON Module in Java? - GeeksforGeeks
March 2, 2022 - Download the latest GSON archive: https://search.maven.org/artifact/com.google.code.gson/gson/2.8.6/jar (or) Maven:
🌐
Maven Repository
mvnrepository.com › artifact › com.squareup.retrofit2 › converter-gson
Maven Repository: com.squareup.retrofit2 » converter-gson
May 15, 2025 - A Retrofit Converter which uses Gson for serialization. ... aar android apache api arm assets build build-system bundle client clojure cloud config cran data database eclipse example extension framework github gradle groovy io ios javascript jvm kotlin library logging maven mobile module npm osgi persistence plugin resources rlang sdk server service spring sql starter testing tools ui web webapp