0

A Maven dependency is loaded, expected types are present in the jar in .m2, yet IntelliJ paints the import in red.

I tried deleting the dependency directory and loading it again, it didn't help.

<?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>com.example</groupId>
    <artifactId>dbftest</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <id>us_army</id>
            <url>https://www.hec.usace.army.mil/nexus/repository/maven-public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.xBaseJ</groupId>
            <artifactId>xBaseJ</artifactId>
            <version>20140212</version>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.13.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
import org.junit.jupiter.api.Test;
import org.xBaseJ.DBF; // in red

public class XBaseJTest {

    @Test
    public void testCompilation() {}
}

expected DBF class is present in the jar

DBF class is in red

Interestingly, mvn test-compile does not fail.

Why?

1 Answer 1

0

Invalidate IDE caches.

Once it's done, the import is no longer shown in red in the IDE.

IntelliJ IDEA - File - Invalidate Caches...

DBF class successfully referenced, not in red

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.