Intellij Idea files with a red circle

IntelliJ recognises that this is a java file, but it's not marked as part of the project source. Check that your project is following the maven standards, and if not configure the pom to tell it where your sources are. You can fix this temporarily in IntelliJ by right clicking on the source root (that's 'java' in the maven standards) and choosing to 'Mark Directory As --> Source Root'


When you create a module, typically it has one content root. You can create additional (and remove) content roots as explained in IntelliJ's Configuring Content Roots documentation.

However, it is possible that you imported a maven project that contains modules. In other words, you have a directory structure with sub-modules as shown below:

parent-proj/
|
|--module-a-proj/
|  |-- src/
|  |-- pom.xml
|
|--module-b-proj/
|  |-- src/
|  |-- pom.xml
|
|-- pom.xml

If you look in the parent-proj/pom.xml you should see a <modules></modules> section. If your <modules> contains your sub-modules (such as module-a-proj and module-b-proj in our example above) then IntelliJ will properly add their src directories as content roots.

On the other hand, if the sub-modules are not included in the parent pom then you might see the red symbol that indicates Java class located out of the source root.

Therefore, using our example above, the parent-proj/pom.xml should look something like the pom example below. The pom example is intentionally sparse and is for demonstration purposes only. In particular, pay attention to the <modules> section.

<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.your.groupid</groupId>
    <artifactId>parent-proj</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <modules>
        <module>module-a-proj</module>
        <module>module-b-proj</module>
    </modules>

    <dependencies></dependencies>
</project>