Maven 依赖:无法获取源。相反,存根源已由反汇编程序生成

tan*_*ado 1 java maven visual-studio-code

当我导航到 Maven 依赖项类时,我得到一个 .class 文件,上面有此注释,并且没有显示任何文档:

// 获取源失败。相反,存根源是由反汇编程序生成的。
// 方法的实现不可用。

我没有 Java 类的问题,只有 Maven 依赖项的问题。

我已经在 maven settings.xml 和 java 扩展包设置中启用了下载源。

有人知道如何解决这个问题吗?

小智 5

我有同样的问题,我解决了,试试这个:

  1. 在vscode中设置settings.json, "java.eclipse.downloadSources": true,"java.maven.downloadSources": true
  2. 在maven的settings.xml中添加以下设置:
<settings>
    <!-- ... other settings omitted ... -->
    <profiles>
        <profile>
            <id>downloadSources</id>
            <properties>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </properties>
        </profile>
    </profiles>

    <activeProfiles>
            <activeProfile>downloadSources</activeProfile>
    </activeProfiles>
</settings>
Run Code Online (Sandbox Code Playgroud)

3.重新打开vscode,它会下载javadoc