'Error building maven project in Intellij : "object apache is not a member of package org"

Whenever I try to run my main program directly in IntelliJ I get this error:

Error:(5, 12) object apache is not a member of package org
import org.apache.commons.io.FileUtils

I'm getting a lot of errors like this when trying to import any dependencies.

I added this line of code to my pom.xml, which made it possible to build the project in a terminal with the "mvn clean install command" <packaging>pom</packaging>

It still doesn't fix the errors in IntelliJ.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source