riorio
riorio

Reputation: 6816

Maven project in Intellij, as a module, is not recognizing new maven dependencies

I had a maven project in IntelliJ that worked fine. I moved the project to be a module within the original project.

I guess I did something wrong, as now when I add dependencies to the inner pom file (and even manually performing "reimport") the IntelliJ is not recognizing the new dependencies.

For example, I add this dependency:

        <dependency>
           <groupId>org.apache.commons</groupId>
           <artifactId>commons-lang3</artifactId>
           <version>3.8</version>
        </dependency>

But in the code editor, this code

        org.apache.commons.lang3.math.NumberUtils

Is marked with red:

cannot resolve NumberUtils

And IntelliJ gives in the red light bulb the suggestion to

Add library Maven:org..... commons-lang3:3.8 to classpath

Instead of the regular "import class" option.

The module has a .iml file and its own .pom file

Upvotes: 2

Views: 9822

Answers (1)

Ibrahim Altamimi
Ibrahim Altamimi

Reputation: 21

For some reason re-import did not do the trick. After looking at this:

http://www.jetbrains.com/idea/webhelp/maven-importing.html

I set auto-import and then the problem went away though; hopefully it helps someone else. Thanks for the ideas everyone :).

Upvotes: 2

Related Questions