Eclipse 内容协助 Maven 项目未获取所有类

发布于 2024-08-06 01:20:13 字数 211 浏览 1 评论 0原文

我使用的是 Eclipse 3.5.0,并使用 SCM 向导(M2 插件)中的导入 maven 项目导入了一个 Maven 项目。

我的 pom.xml 中有一个 jar 文件作为依赖项。 jar 里面有一个复杂的模式 - 有相当多的 XSD。但内容辅助似乎根本没有获取架构,也没有获取依赖项列表中的许多其他类。然而对于同一项目中的另一个模块,它似乎工作正常。有谁知道这是为什么?这让我发疯!

I'm using Eclipse 3.5.0, and have imported a maven project using the import maven project from SCM wizard (M2 plugin).

I have a jar file as a dependency in my pom. and inside the jar is a complicated schema - with quite a number of XSD's. But the content assist doesn't seem to pick up the schema at all, nor a number of other classes in the dependency list. yet for another module in the same project it seems to work ok. Does anyone know why this is? it's driving me mad!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蒲公英的约定 2024-08-13 01:20:13

在缺乏有关模块结构的任何详细信息的情况下,此解决方法可能会有所帮助。

您可以定义目录贡献以使 Eclipse 了解模式并允许它们为内容辅助/验证做出贡献。

  • 打开 Window->Preferences->XML->XML Catalog
  • 选择User Specified EntriesAdd...
  • 添加文件系统中 Jar 的路径,然后添加相对路径架构 jar 内的路径(例如 c:.m2\repo\name\seller\rich\my-artifact\1.0\my-artifact-1.0.jar!\path\to\my\schema.xsd
  • )键,这将用作使用模式的 XML 文件中的默认键。
  • 单击“确定”返回编辑器。

假设您已正确定义模式声明,您现在应该可以在编辑器中使用该模式...

XML 目录贡献

In the absence of any details regarding the modules' structure, this workaround may help.

You can define Catalog Contributions to make Eclipse aware of schemas and allow them to contribute to content assist/validation.

  • Open Window->Preferences->XML->XML Catalog
  • Select User Specified Entries and Add...
  • Add the path to Jar in the filesystem, then the relative path within the jar of the schema (e.g. c:.m2\repo\name\seller\rich\my-artifact\1.0\my-artifact-1.0.jar!\path\to\my\schema.xsd)
  • Give it a key, this will be used as the default key in XML files using the schema
  • Hit OK to get back to the editor.

You should now have the schema available for use in the editor, assuming you've defined your schema declarations correctly...

XML Catalog Contributions

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文