简体   繁体   English

如何包含用于选择所需插件的功能?

[英]How to include features to pick up required plugins?

I'm trying to create an update-site that is a combination of my own features and Eclipse features, which I'm adding into a "parent" feature so I only have one feature option when installing. 我正在尝试创建一个将我自己的功能和Eclipse功能结合在一起的更新站点,我将它们添加到“父”功能中,因此在安装时只有一个功能选项。

One of my plugins depends on an Eclipse plugin - org.eclipse.jst.j2ee.webservice, which is a required plugin in org.eclipse.jst.enterprise_core.feature. 我的一个插件依赖于Eclipse插件org.eclipse.jst.j2ee.webservice,这是org.eclipse.jst.enterprise_core.feature中的必需插件。 When adding that feature to my parent feature, only the feature itself is added and not the required plugins. 将功能添加到我的父功能时,仅添加功能本身,而不添加必需的插件。 Which I guess is expected. 我想这是预期的。 Is the best practice to include just the required plugin or is there another way to handle this? 最佳做法是仅包含必需的插件,还是有另一种方法来处理此问题?

<feature
      id="com.my.parent.feature"
      label="%featureName"
      version="1.0.0.qualifier">

   <includes
         id="com.first.feature"
         version="0.0.0"/>    
   <includes
         id="com.second.feature"
         version="0.0.0"/>    
   <includes
         id="com.third.feature"
         version="0.0.0"/>    

   <!-- Only adds feature to update site -->
   <includes
         id="org.eclipse.jst.enterprise_core.feature"
         version="0.0.0"/>

   <!-- plugin gets added to update site -->
   <plugin
         id="org.eclipse.jst.j2ee.webservice"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>
</feature>



<feature
      id="org.eclipse.jst.enterprise_core.feature"
      label="%featureName"
      version="3.10.0.v201803082036"
      provider-name="%providerName">

   <requires>
      <import plugin="org.eclipse.jst.j2ee.webservice"/>
      <import plugin="org.eclipse.jst.j2ee.ejb"/>
      <import plugin="org.eclipse.jst.j2ee.jca"/>
      <import plugin="org.eclipse.jst.jee.ejb"/>
   </requires>

</feature>

This is the usual way to do a feature. 这是完成功能的常用方法。

The 'contact all update sites to find required software' option in Help > Install New Software will find the included features in the appropriate update site. 帮助>安装新软件中的“联系所有更新站点以找到所需的软件”选项将在相应的更新站点中找到所包含的功能。 This ensures that the correct plugins for the user's release of Eclipse are used. 这样可以确保使用针对用户的Eclipse版本的正确插件。

If you included the plugins in your update site they may be the wrong version for the user's Eclipse and might cause install or run-time problems. 如果您在更新站点中包括了插件,那么对于用户的Eclipse,它们可能是错误的版本,并可能导致安装或运行时问题。

Note that you should add standard Eclipse features as 'Dependencies' rather than included features (this will end up in the requires section of the feature.xml). 请注意,您应该添加标准的Eclipse功能为“依赖”,而不是包含的功能(这最终会在requires的feature.xml的部分)。 You can specify things like a minimum version for the dependent feature here. 您可以在此处指定相关功能的最低版本等内容。

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

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