Eclipse插件与外部第三方jar [英] Eclipse plugin with external third party jar
问题描述
在Plugin manifest.mf中我有
Manifest-Version:1.0
Bundle-ManifestVersion:2
Bundle-Name:%pluginName
Bundle-SymbolicName:EaCom-plugin; singleton:= true
Bundle-版本:2.1.0
需求包:org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment:JavaSE-1.6
Bundle-ClassPath:。,
external:$ eaapi_location $ /eaapi.jar
Bundle-NativeCode:external:$ eaapi_location $ / SSJavaCOM.dll
导出包:org.sparx
捆绑供应商:%pluginVendor
在运行时 - >导出的包我添加了
org.sparx
在类路径下我有
external:$ eaapi_location $ / eaapi.jar
build.properties
source .. = src / main / java /,\
src / main / scala /,\
src / main / resources /,\
src / test / java /,\
src / test / scala /,\
src / test / resources /
output .. = bin /
bin.includes = META-INF /,\
在build.properties中,我第一次发出警告线。警告是
source.external:$ eaapi_location $ / eaapi.jar构建条目缺失
我导出产品:myrcpapp.exe和我的产品的配置文件myrcpapp.ini添加vm参数:-Deaapi_location = C:/ JavaAPI
我收到以下错误
错误消息:java.lang.error:未解决的编译问题:存储库无法解析为类型
虽然我在eclipse中运行时工作正常我失踪了什么?
非常感谢任何帮助。
感谢
我解决了我的问题。实际的情况是,我有一个包含在包装器插件项目中的第三部分jar,并且被其他插件所需要编译成功。在编译(导出产品)期间,这些其他插件使用位于包装器插件中的jar来成功编译,因此我需要在包装器插件的java类路径下提供jar的位置。
但是一旦产品出口,我不希望这个jar是产品的一部分,因为它的第三方jar,不应该分发exe。所以解决方案是
在包装器插件Manifest - > Runtime Tab - > Classpath提供jar的位置。在我的情况下,它是
src / main / resources / thridparty.jar
/ pre>
在生成选项卡 - >二进制构建选择唯一的清单。
在MANIFEST.MF包括
Bundle-ClassPath:external:$ thirdpartyjar_location $ / thirdparty.jar,
src / main / resources / thirdparty。 jar
导出产品并在产品配置文件下添加系统属性
-Dthirdpartyjar_location = path / to / the / thirdpartyjar
当您使用exe运行产品时,将使用您在配置中提供的外部路径的jar。
希望它可以帮助某人。 p>
I have an RCP application which includes different plugins. In one of the plugin I am using an external third party jar. Due to copyrights reasons I cannot bundle that jar into my product. So I try to include the jar as external jar at runtime. what I have done is as follows
In the Plugin manifest.mf I have
Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: EaCom-plugin;singleton:=true Bundle-Version: 2.1.0 Require-Bundle: org.eclipse.core.runtime Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ClassPath: ., external:$eaapi_location$/eaapi.jar Bundle-NativeCode: external:$eaapi_location$/SSJavaCOM.dll Export-Package: org.sparx Bundle-Vendor: %pluginVendor
Under Runtime -> Exported Packages I added
org.sparx
Under the classpath I have
external:$eaapi_location$/eaapi.jar
build.properties
source.. = src/main/java/,\ src/main/scala/,\ src/main/resources/,\ src/test/java/,\ src/test/scala/,\ src/test/resources/ output.. = bin/ bin.includes = META-INF/,\
In the build.properties I have a warning on the very first line. The warning is
source.external:$eaapi_location$/eaapi.jar build entry is missing
I export the product: myrcpapp.exe and in the config file of my product myrcpapp.ini add vm arguments:-Deaapi_location=C:/JavaAPI
I get the following error
error message : java.lang.error: unresolved compilation problems: Repository cannot be resolved into a type
Though it works fine when I run in eclipse What I am missing ?
Any help will be highly appreciated.
Thanks
解决方案Ok I Solved my problem. The actual scenario was that I had a third part jar which was included in the wrapper plugin project and is required by other plugins to compile successfully. During the compilation (exporting the product) these other plugins uses the jar located in the wrapper plugin for successful compilation and for that I needed to provide the location of the jar under the java classpath of the wrapper plugin.
But once the the product is exported I didn't want this jar to be the part of the product, since its a third party jar and it should not be distributed with the exe. So the solution is
Under the wrapper plugin Manifest -> Runtime Tab -> Classpath provide the location of the jar. In my case it was
src/main/resources/thridparty.jar
Under the Build tab -> Binary Build select only manifest.
In the MANIFEST.MF include
Bundle-ClassPath: external:$thirdpartyjar_location$/thirdparty.jar, src/main/resources/thirdparty.jar
Export the product and under the product configuration file add the system property
-Dthirdpartyjar_location=path/to/the/thirdpartyjar
When you run the product using the exe it will use the jar from external path you provided in configuration.
Hope it will help someone.
这篇关于Eclipse插件与外部第三方jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!