Search code examples
mavenintellij-idea

IntelliJ does not recognize generated sources


There are already many similar questions, but none of the proposed solutions (mainly "Clear caches and restart IntelliJ) solves my problem.

I have a maven project that I imported into IntelliJ Community Edition 2017.1 . My maven build automatically creates some java sources from Google protobuf specifications.

Excerpt from pom.xml

         <plugin>
            <groupId>com.github.os72</groupId>
            <artifactId>protoc-jar-maven-plugin</artifactId>
            <version>3.2.0</version>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <protocVersion>3.1.0</protocVersion> <!-- 2.4.1, 2.5.0, 2.6.1, 3.1.0 -->
                        <inputDirectories>
                            <include>src/main/protobuf</include>
                        </inputDirectories>
                        <outputDirectory>${project.build.directory}/generated-sources/protobuf</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>

The folder /generated-sources/protobuf is correctly recognized as "generated-sources" with a blue icon and the wheel for generated sources under IntelliJ -> File -> Project Structure -> Modules -> Sources

The maven target "compile" also works fine.

But the IntelliJ "internal" java compiler complains "Cannot resolve symbol" for my generated class.

Solutions I tired so far

  1. add an intermediate folder /target/generated-sources/protobuf/ => did not help
  2. Invalidate caches, delete project file, reimport, restart IDE => did not help
  3. Maven -> Reimport all projects => did not help

Any more suggestions?


Solution

  • SOLUTION: The generated files were to large. Had to increase

    idea.max.intellisense.filesize=2500
    

    in IDE_HOME\bin\idea.properties as described here: File size exceeds configured limit (2560000), code insight features not available