Home > OS >  IntelliJ IDEA does not recognize the format of GraphQL schema in resources directory
IntelliJ IDEA does not recognize the format of GraphQL schema in resources directory

Time:12-08

I'm trying to learn GraphQL but after I inserted the dependencies intellij still not recognizing the format .graphqls of the schema, I created new Spring boot project and the problem still persisted, it's 2022 and we have no good tutorials how to deal with these kind of errors, can this be caused by spring boot 3.0? , do I need to go to an earlier version or what can be the problem here , I want to learn but it's impossible I go from strange error to the next with no tutorials online how to deal with them, now instead of learning GraphQL I have to waste 3 days how to setup this damn data query language.

Here how it looks in IntelliJ:

enter image description here

Here are my dependencies:

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.dailycodebuffer</groupId>
    <artifactId>employee-system-api</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>employee-system-api</name>
    <description>employee-system-api</description>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-graphql</artifactId>
        </dependency>

        <dependency>
            <groupId>com.graphql-java</groupId>
            <artifactId>graphql-java-tools</artifactId>
            <version>5.2.4</version>
        </dependency>



        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>


    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

I'm tired of wasting days in doing setups, the knowledge is spread in many pages and the spring main site is confusing, it's 2022 and it feels like we are in the 2000s when we don't have proper tutorials on GraphQL, Spring Security and other aspects of spring boot.

CodePudding user response:

According to the weird icon of your graphqls file

enter image description here

instead of

enter image description here

and the weird error message

Image not loaded

enter image description here

it sounds like IntelliJ Idea considers your file as an image file.

  • Check if you have the enter image description here

    • If you don't have it like above, search for the icon your IntelliJ marks your graphqls file with and find where it is registered wrongly.
  • Related