使用目标平台时无法在 Eclipse RCP 应用程序中使用 Maven 依赖项
我有一个大型 Eclipse RCP 应用程序,其中有很多传递依赖项。
目前,这些是手动复制到类路径中的,但这是我想避免的重大管理开销,而是想使用 Maven,如 此处讨论。
我创建了一个简单的 RCP 应用程序。
我创建了一个 target-platform.target
,它导入 RCP 依赖项和我的 Maven 依赖项:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target includeMode="feature" name="Running Platform">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="http://download.eclipse.org/releases/2021-03" />
<unit id="org.eclipse.sdk.feature.group" version="0.0.0" />
<unit id="org.eclipse.emf.edit.feature.group" version="0.0.0" />
<unit id="org.eclipse.equinox.p2.core.feature.feature.group" version="0.0.0" />
<unit id="org.eclipse.gef.sdk.feature.group" version="0.0.0" />
</location>
<location includeDependencyDepth="infinite" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>osh-core</artifactId>
<version>5.4.0</version>
<type>jar</type>
</dependency>
</dependencies>
</location>
</locations>
</target>
我已将其设置为 Active Target Platform
,但是当我尝试时要在我的应用程序中访问此依赖项的内容(例如使用new oshi.SystemInfo.SystemInfo()
),它无法解析。
我想我需要将它作为插件添加到 manifest.mf
中,它适用于我尝试过的其他 Maven 依赖项,但不适用于这个 - 它不会显示在插件的 GUI 列表中添加。
如果我手动为其添加一个 Require-Bundle
条目:
wrapped.com.github.oshi.oshi-core;bundle-version="5.4.0"
我得到:
Bundle 'wrapped.com.github.oshi.oshi-core' 无法解析
如果我尝试,会得到类似的结果:
com.github.oshi.oshi-core;bundle-version="5.4.0"
我有一个类似的场景,但使用了不同的库。
target-platform.target
:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target includeMode="feature" name="Running Platform">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="http://download.eclipse.org/releases/2021-03" />
<unit id="org.eclipse.sdk.feature.group" version="0.0.0" />
<unit id="org.eclipse.emf.edit.feature.group" version="0.0.0" />
<unit id="org.eclipse.equinox.p2.core.feature.feature.group" version="0.0.0" />
<unit id="org.eclipse.gef.sdk.feature.group" version="0.0.0" />
</location>
<location includeDependencyDepth="infinite" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>com.github.xni06</groupId>
<artifactId>JCoord</artifactId>
<version>24347197e2364650a6b1cf2cc46d064414edc22a</version>
<type>jar</type>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
</location>
</locations>
</target>
如果我手动为其添加 Require-Bundle
条目:
wrapped.com.github.xni06.JCoord;bundle-version=" 24347197e2364650a6b1cf2cc46d064414edc22a"
我得到:
无效范围“24347197e2364650a6b1cf2cc46d064414edc22a”:无效版本“24347197e2364650a6b1cf2cc46d064414edc22a”:非数字"24347197e2364650a6b1cf2cc46d064414edc22a"
当我尝试:
wrapped.com.github.xni06.JCoord;bundle-version="0.0.0"
我得到:
无效范围“24347197e2364650a6b1cf2cc46d064414edc22a”:无效版本“24347197e2364650a6b1cf2cc46d064414edc22a”:非数字"24347197e2364650a6b1cf2cc46d064414edc22a"
如何导入这些依赖项?
I have a large Eclipse RCP application with lots of transitive dependencies.
Currently, these are manually copied into the classpath but that's a significant administrative overhead I'd like to avoid, and would instead like to use Maven, as discussed here.
I've created a simple RCP application.
I've created a target-platform.target
, which imports the RCP dependencies and my Maven dependency:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target includeMode="feature" name="Running Platform">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="http://download.eclipse.org/releases/2021-03" />
<unit id="org.eclipse.sdk.feature.group" version="0.0.0" />
<unit id="org.eclipse.emf.edit.feature.group" version="0.0.0" />
<unit id="org.eclipse.equinox.p2.core.feature.feature.group" version="0.0.0" />
<unit id="org.eclipse.gef.sdk.feature.group" version="0.0.0" />
</location>
<location includeDependencyDepth="infinite" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>osh-core</artifactId>
<version>5.4.0</version>
<type>jar</type>
</dependency>
</dependencies>
</location>
</locations>
</target>
I've set this as the Active Target Platform
, but when I attempt to access the contents of this dependency in my application (e.g. by using new oshi.SystemInfo.SystemInfo()
), it can't be resolved.
I thought I needed to add it as a plugin in the manifest.mf
, which worked for other Maven dependencies I tried, but not this one - it doesn't show up in the GUI list of plugins to add.
And if I add a Require-Bundle
entry for it manually:
wrapped.com.github.oshi.oshi-core;bundle-version="5.4.0"
I get:
Bundle 'wrapped.com.github.oshi.oshi-core' cannot be resolved
And get a similar if I try:
com.github.oshi.oshi-core;bundle-version="5.4.0"
I have a similar scenario with a different library.
target-platform.target
:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target includeMode="feature" name="Running Platform">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="http://download.eclipse.org/releases/2021-03" />
<unit id="org.eclipse.sdk.feature.group" version="0.0.0" />
<unit id="org.eclipse.emf.edit.feature.group" version="0.0.0" />
<unit id="org.eclipse.equinox.p2.core.feature.feature.group" version="0.0.0" />
<unit id="org.eclipse.gef.sdk.feature.group" version="0.0.0" />
</location>
<location includeDependencyDepth="infinite" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>com.github.xni06</groupId>
<artifactId>JCoord</artifactId>
<version>24347197e2364650a6b1cf2cc46d064414edc22a</version>
<type>jar</type>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
</location>
</locations>
</target>
If I add a Require-Bundle
entry for it manually:
wrapped.com.github.xni06.JCoord;bundle-version="24347197e2364650a6b1cf2cc46d064414edc22a"
I get:
invalid range "24347197e2364650a6b1cf2cc46d064414edc22a": invalid version "24347197e2364650a6b1cf2cc46d064414edc22a": non-numeric "24347197e2364650a6b1cf2cc46d064414edc22a"
And when I try:
wrapped.com.github.xni06.JCoord;bundle-version="0.0.0"
I get:
invalid range "24347197e2364650a6b1cf2cc46d064414edc22a": invalid version "24347197e2364650a6b1cf2cc46d064414edc22a": non-numeric "24347197e2364650a6b1cf2cc46d064414edc22a"
How can I get these dependencies imported?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论