J
J
Jake Taylor2021-04-19 02:05:44
Maven
Jake Taylor, 2021-04-19 02:05:44

Why doesn't IntellijIDEA see the Maven dependency?

I have a project in IntellijIDEA created with Maven.
pom.xml content:

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>by.tarasiuk</groupId>
    <artifactId>task_01</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.13.3</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.13.3</version>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.10</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>


I clicked on this icon:
607cbad5dce13791716149.png

Here is a list of project libraries (everything is pulled up by Maven):
607cbb3419e95306435124.png
607cbb9ce78a4065854586.jpeg

When manually imported, the IntellijIDEA logger interface sees:
607cbd1d33072215072186.jpeg

When trying to create a log4j logger object in the project class, the log4j library is not found:
607cba7a6b9dd076560780.jpeg

Question - why?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Jake Taylor, 2021-04-19
@n199a

It was decided like this:
1) Press Shift+ Ctrl+ Alt+ S, go to Librariesand delete all libraries.
2) On the right side of the IntellijIDEA window, click on the `Maven` tab and select this:

Click to see screenshot

607cd0c755977696409561.jpeg

3) Enjoy :)

T
Toba_Bot, 2022-03-20
@Toba_Bot

Good day, I had a similar problem, and I solved it as advised above.
Removed all Libraries and then went to pom.xml and clicked on update.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question