Eclipse书籍部分翻译(英译中)4

来源:百度知道 编辑:UC知道 时间:2024/07/02 21:08:49
Bundling by Reference
Warning
This approach is experimental in Eclipse 3.1 and is subject to change. It breaks some fundamental notions of plug-in encapsulation and is not compatible with various parts of the Eclipse tooling. It does, however, address some real use cases. Use with caution and only when absolutely needed.
In some situations, installed JARs cannot be moved let alone modified. This typically happens when the libraries are delivered as part of another product and are laid down by an installer. The JARs are in a specific spot and are expected to be there to be found by other programs.
The bundling approaches outlined so far do not work because they modify either the JAR itself or its surroundings. For example, wrapping adds plug-in metadata beside the JAR being wrapped. If there is only one set of JARs to wrap in a directory, the generated metadata can be directly added to that directory. If there are multiple libraries in the same directory, the metadat

捆绑的参考
警告
这种方法是在Eclipse实验3.1和随时可能更改。它打破一些基本概念的插件封装和不符合各部分的Eclipse工具。然而,它确实解决一些实际使用情况。请小心使用,只有在绝对必要的。
在某些情况下,安装罐子不能移动更不用说修改。这通常发生时,图书馆提供的一部分,另一种产品,并规定了安装。该罐是在特定的位置,并预计将有被发现的其他程序。
捆绑的方法概述迄今没有工作,因为他们要么修改的JAR文件本身或其周围地区。例如,包装增加了插件旁边的数据被包裹JAR文件。如果只有一套罐包装的目录中,所产生的数据可直接加入到该目录。如果有多个图书馆在同一目录,元数据文件相互冲突。元注射液只能用于如前面提到的问题是不适用。例如, JAR文件必须写的。
即使注射或包装使用,还有的问题是如何获得由此产生的插件安装到Eclipse的。自然Eclipse的模式是有插件,无论是在主要的插件目录中的Eclipse安装或在插件目录中的延伸位置。这两种方法要求移动捆绑的新图书馆。插件可以安装使用的标记在config.ini文件(见第26章的讨论osgi.bundles财产) ,但是这是繁琐复杂,难于管理。最好是简单地创建一个插件,在一个正常的位置(即,在一个插件目录,就是著名的的Eclipse )和点所需的罐子在任何地方都可以在磁盘上,也就是说,把元一边离开外部的代码罐子的插件。
为了说明这一工程,认为神秘的Java数据库连接( JDBC )驱动程序JAR文件附带的数据库产品。该产品安装了jdbc.jar在c : \分贝\驱动程序\ jdbc.jar ,你不能修改,移动或添加文件的驱动器的目录。
要设置此行动,着手好像您使用的是包装的做法从一节。执行新建项目向导并创建一个JDBC的插件的基础上jdbc.jar 。不要担心图书馆被复制到项目;您可以使用他们做您的正常发展。
当你去运行您的应用程序,您需要使用原始的JDBC图书馆。使用下列步骤,成立了结构如图20-4 :