简体   繁体   English

Eclipse内容有助于Maven项目不使用所有类

[英]Eclipse content assist with maven project not picking up all classes

I'm using Eclipse 3.5.0, and have imported a maven project using the import maven project from SCM wizard (M2 plugin). 我正在使用Eclipse 3.5.0,并且已经使用SCM向导(M2插件)中的import maven项目导入了一个maven项目。

I have a jar file as a dependency in my pom. 我在pom中有一个jar文件作为依赖项。 and inside the jar is a complicated schema - with quite a number of XSD's. 在jar内是一个复杂的架构-带有许多XSD。 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! 让我发疯了!

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. 您可以定义Catalog Contributions,以使Eclipse了解模式,并允许它们为内容辅助/验证做出贡献。

  • Open Window->Preferences->XML->XML Catalog 打开窗口->首选项-> XML-> XML目录
  • Select User Specified Entries and Add... 选择用户指定的条目添加...
  • Add the path to Jar in the filesystem, then the relative path within the jar of the schema (eg c:.m2\\repo\\name\\seller\\rich\\my-artifact\\1.0\\my-artifact-1.0.jar!\\path\\to\\my\\schema.xsd) 将路径添加到文件系统中的Jar,然后添加架构的jar中的相对路径(例如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 给它一个密钥,它将用作使用该模式的XML文件中的默认密钥
  • 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目录贡献

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM