Home > other >  ComponentLookupException when importing java project into intellij Idea
ComponentLookupException when importing java project into intellij Idea

Time:11-02

I just download a spring boot project from enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Here's the pom.xml

<?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>2.7.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>org.springframework.amqp.tutorials</groupId>
    <artifactId>rabbitmq-amqp-tutorials</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>rabbitmq-amqp-tutorials</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-amqp</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

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

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

EDIT:SOLUTION

As pointed out by @Sanura Hettiarachchi there is a bug with the edition of intellij idea I was using, uninstalling and installing the latest version (Intellij Idea 2022.2.3 Community Edition) solved the problem. Now importing an existing project works nicely, no need to manually import modules.

CodePudding user response:

It's not clear what you are trying to achieve. You click "open or import" and add the existing project. After that you try to import the same project again.

If you want to load the maven dependancies right click on the "pom.xml" and select "maven->reload project"

Update: The issue seems to be on intelliJ IDE older versions which should be fixed by now. https://youtrack.jetbrains.com/issue/IDEA-290419/Maven-385-NoSuchMethodError-orgapachemavenmodelvalidationDefaultModelValidator-method-void-init-not-found

  • Related