osgi.baseConfiguration.area无法使用相对路径解析 [英] osgi.baseConfiguration.area does not resolve using a relative path

查看:152
本文介绍了osgi.baseConfiguration.area无法使用相对路径解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司生产了一小套Eclipse RCP应用程序,这些应用程序安装在Windows上的同一共享位置(C:\Program Files(x86)\MyCompany)。它们共享一个插件目录,但是具有单独的配置区域。

My company produces a small suite of Eclipse RCP applications that are installed into the same shared location on Windows (C:\Program Files (x86)\MyCompany). They share a plug-ins directory but have separate configuration areas.

osgi.configuration.area,osgi.user.area和osgi.instance.area的所需位置。位于用户的漫游应用程序数据区域中(在Windows XP / 7中为%APPDATA%)。由于本地化要求和操作系统之间路径位置的差异,在PRODUCT.ini启动程序文件中从@ user.home开始构建路径是不够的。 错误241192 添加了在config.ini文件中指定环境变量的功能,但不在PRODUCT.ini文件中。

The desired location for osgi.configuration.area, osgi.user.area, and osgi.instance.area are in a user's roaming application data area (%APPDATA% on Windows XP/7). Due to localization requirements and differences in path locations between the OSes, it is not sufficient to build a path in the PRODUCT.ini launcher file starting from @user.home. Bug 241192 added the ability to specify environment variables in the config.ini file, but not in the PRODUCT.ini file.

这是安装目录结构:

C:/Program Files (x86)/MyCompany
  configurationProgram1/config.ini
  configurationProgram2/config.ini
  configurationProgram3/config.ini
  jre/
  plugins/*.jar
  Program1.exe
  Program1.ini
  Program2.exe
  Program2.ini
  Program3.exe
  Program3.ini

这是一个PRODUCT.ini文件示例:

This is an example PRODUCT.ini file:

--launcher.defaultAction
openFile
-clean
-vmargs
-Xmx768m
-Dosgi.locking=none
-Dosgi.requiredJavaVersion=1.7
-Dvisualvm.display.name=Program1
-Dosgi.baseConfiguration.area=file:configurationProgram1
-Dosgi.sharedConfiguration.area=file:configurationProgram1

这是一个示例config.ini文件:

This is an example config.ini file:

#Product Runtime Configuration File
eclipse.application=com.mycompany.app.program1.application
osgi.bundles.defaultStartLevel=4
eclipse.product=com.mycompany.app.program1.product
osgi.splashPath=platform:/base/plugins/com.mycompany.app.program1
osgi.bundles= ...
  org.eclipse.equinox.common@2:start,\
  ...
  org.eclipse.equinox.launcher.win32.win32.x86,\
  org.eclipse.swt.win32.win32.x86
osgi.configuration.area=$APPDATA$/MyCompany/Program1/configuration
osgi.user.area=$APPDATA$/MyCompany/Program1/user
osgi.instance.area=$APPDATA$/MyCompany/Program1/instance

如果工作目录在安装目录中,应用程序启动(例如双击Windows资源管理器中的exe,使用快捷方式(定义为安装目录的开始于变量),将osgi.baseConfiguration.area的相对路径解析为正确的绝对路径,并设置osgi.configuration.area到APPDATA中的正确位置。如果工作目录不是安装目录(例如,通过双击与该程序关联的资源管理器中的文件来打开应用程序,从任何非安装目录中从命令行启动),程序将启动,但是osgi.baseConfiguration.area是仍然被列为相对路径,并且osgi.configuration.area恢复到其后备位置(对于管理员:C:/程序文件(x86)/ MyCompany / configuration,对于用户:%USERPROFILE%/。eclipse / configuration)。

If the working directory is in installation directory when the application is launched (e.g. double-click the exe in Windows Explorer, use a shortcut with the "Start in" variable defined as the installation directory), the relative path for osgi.baseConfiguration.area is resolved to the correct absolute path and osgi.configuration.area is set to the correct location in APPDATA. If the working directory is not the installation directory (e.g. open the application by double-clicking a file in Explorer associated with the program, launch from the command line from any non-installation directory), the program launches but osgi.baseConfiguration.area is still listed as a relative path and osgi.configuration.area reverts to its fallback position (for admins: C:/Program Files (x86)/MyCompany/configuration, for users: %USERPROFILE%/.eclipse/configuration). osgi.user.area and osgi.instance.area are correctly set in both instances.

我的自定义本地配置(configurationProgram1 / config.ini)清晰可见,否则应用程序将完全无法启动。但是,在出现问题的情况下,Equinox启动器将忽略我的osgi.configuration.area声明或对其进行重置。我不知道如何逐步调试Equinox启动器启动类(org.eclipse.equinox.launcher.Main)来进一步诊断问题。如果将osgi.baseConfiguration.area定义为绝对路径而不是相对路径,则会观察到正确的行为。

My custom local configuration (configurationProgram1/config.ini) is clearly found, otherwise the application would fail to launch at all. However in the problem case, the Equinox launcher is either ignoring my osgi.configuration.area declaration or resetting it. I do not know how to step through the Equinox launcher start up class (org.eclipse.equinox.launcher.Main) to diagnose the problem further. The correct behavior is observed if osgi.baseConfiguration.area is defined as an absolute path rather than a relative path.

RCP应用程序基于Eclipse Platform 3.8.1。我确认问题仍然存在于3.x分支的最新版本3.8.2中。目前,升级到e4平台不是一个可行的选择,但我想知道该问题是否已在e4中解决。

The RCP applications are based on Eclipse Platform 3.8.1. I confirmed the problem still exists in version 3.8.2, the last release of the 3.x branch. Upgrading to the e4 platform is not a viable option at this time, but I would be interested in knowing if this issue is fixed in e4.

我意识到我的共享安装适用于多个应用程序是一种独特的情况,因为共享安装的假设似乎是一个具有多个用户本地配置和一个共享配置的单个应用程序。我仍然怀疑这是一个Equinox错误;但是,在执行此操作之前,我想问一下社区是否对这些osgi属性进行了错误配置或错误地理解了文档。

I realize my shared installation for multiple application is a unique case as the assumptions for a shared installation appear to be a single application with multiple local configurations for users and a single shared configuration. Still I suspect this is an Equinox bug; however, I wanted to ask the community whether I have misconfigured my installation or have misunderstood the documentation with regard to these osgi properties before doing so.

推荐答案

@SheldonWarkentin在另一个问题中报告了LocationManager( 3.9分支中的文件)要求plugins /和configuration /目录位于同一目录中,并且要准确命名,以便使用相对路径,该相对路径必须由-startup和--launcher.library定义为定义plugins /目录。他的建议解决了我的紧迫问题。

@SheldonWarkentin reported in another question that LocationManager (file in 3.9 branch) requires the plugins/ and configuration/ directories to be in the same directory and named exactly so in order to use a relative path, which must be defined by -startup and --launcher.library to define the plugins/ directory. His recommendation addresses my immediate concerns.

我正在使用此答案来改善 Eclipse错误426189 ( osgi.baseConfiguration.area和-configuration无法使用相对路径解析),我提交了此文件来解决此问题。当Equinox团队解决此错误时,我将关闭此问题。

I am using this answer to improve the visibility of Eclipse Bug 426189 ("osgi.baseConfiguration.area and -configuration does not resolve using a relative path"), which I submitted to address this issue. I will close this question when this bug is addressed by the Equinox team.

更新:已修复Eclipse错误

错误426189已修复,将成为Eclipse 4.4(Luna)版本的一部分。

Bug 426189 was fixed and will be part of the Eclipse 4.4 (Luna) release.

这篇关于osgi.baseConfiguration.area无法使用相对路径解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆