IntelliJ doesn't recognize generated sources
There are many similar questions already, but none of the suggested solutions (basically "Clear caches and restart IntelliJ" solve my problem.
I have a maven project that I imported into IntelliJ Community Edition 2017.1. My maven build automatically generates some java sources from google protobuf specs.
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 blue icon and wheel for generated sources in IntelliJ -> File -> Project Structure -> Modules -> Sources
The maven target command also works fine.
But IntelliJ's built-in Java compiler is complaining about "Cannot resolve symbol" for my generated class.
Decisions I'm tired of so far
- adding intermediate folder / target / generated sources / protobuf / => didn't help
- Invalid caches, delete project file, reimport, restart IDE => didn't help
- Maven -> Reimport all projects => didn't help
Other offers?
source to share
SOLUTION: The generated files were large. Had to increase
idea.max.intellisense.filesize=2500
in IDE_HOME\bin\idea.properties
as described here: File size exceeds the set limit (2560000), code drawing functions are not available
source to share
In IntelliJ IDEA 2016 and newer, you can change this setting in Help> Edit Custom Properties .
Older versions don't have a GUI for this. But you can change it if you edit the IntelliJ IDEA platform properties file as described here: https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform -properties
# Maximum file size (kilobytes) IDE should provide code assistance for.
idea.max.intellisense.filesize=50000
# Maximum file size (kilobytes) IDE is able to open.
idea.max.content.load.filesize=50000
Remember to save and reload IntelliJ IDEA.
source to share