首页 > 解决方案 > Java 模型状态 - 不能嵌套在里面

问题描述

我的 Visual Studio Code IDE 在 Maven 构建期间向我显示了这个错误:

ENTRY org.eclipse.jdt.apt.core 4 1 2019-07-31 12:58:13.130
!MESSAGE Failed to add classpath entry for generated source folder annotations
!STACK 1Java Model Exception: Java Model Status [Cannot nest '.../target/generated-sources/annotations' inside '.../target/generated-sources'. To enable the nesting exclude 'annotations/' from '.../target/generated-sources']

屏幕右下方会出现一条通知,显示:

Build failed, do you want to continue?

我可以单击Proceed按钮,构建成功完成。

环境版本:

Version: 1.36.1
Commit: 2213894ea0415ee8c85c5eea0d0ff81ecc191529
Date: 2019-07-08T22:55:08.091Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 5.0.0-050000-generic snap

这是.classpath文件:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry excluding="target/generated-sources/annotations/" kind="src" path=""/>
  <classpathentry kind="src" path="target/generated-sources/annotations">
    <attributes>
      <attribute name="optional" value="true"/>
    </attributes>
  </classpathentry>
  <classpathentry kind="output" path="bin"/>
</classpath>

它们有很多,例如每个子目录一个。如果我删除所有这些,VSCode 将重新创建它们。

我怀疑Language Support for Java(TM)Red Hat 的扩展是创建这些文件的那个。

标签: javavisual-studio-code

解决方案


推荐阅读