已经有很多类似的问题,但提出的解决方案(主要是“清除缓存并重新启动IntelliJ”)都没有解决我的问题。
我有一个导入到IntelliJ Community Edition 2017.1中的Maven项目。我的Maven构建会自动根据Google protobuf规范创建一些Java源代码。
摘录自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>
文件夹 /generated-sources/protobuf 被正确识别为“generated-sources”(带有蓝色图标),并在IntelliJ -〉文件-〉项目结构-〉模块-〉源下带有生成源的滚轮
maven目标“compile”也工作得很好。
但是IntelliJ“内部”java编译器对我生成的类抱怨“无法解析符号”。
解我累为止
1.添加一个中间文件夹/target/generated-sources/protobuf/ =〉没有帮助
1.使缓存无效,删除项目文件,重新导入,重新启动IDE =〉没有帮助
- Maven -〉重新导入所有项目=〉没有帮助
还有什么建议吗?
4条答案
按热度按时间nzrxty8p1#
在IntelliJ IDEA 2016和更新版本中,您可以在帮助〉编辑自定义属性中更改此设置。
在旧版本中,没有GUI来执行此操作。但是,如果您编辑IntelliJ IDEA平台属性文件,则可以更改它,如下所述:https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform-properties
不要忘记保存并重新启动IntelliJ IDEA。
hmmo2u0o2#
解决方案:生成的文件太大。必须增加
在
IDE_HOME\bin\idea.properties
中,如下所述:File size exceeds configured limit (2560000), code insight features not availableddarikpa3#
尝试添加
到目标节点。
eimct9ow4#
如果生成的文件大小不是您的问题;请查看上面的@CrazyCoder注解。2在插件配置中,将执行阶段更改为 process-resources。