外部构建找不到导入

发布于 2024-12-26 13:35:27 字数 1501 浏览 0 评论 0原文

我正在 Eclipse 3.6 上开发一个 Eclipse RCP 项目,该项目分为 3 个 Java 项目。

在此处输入图像描述

从底部开始,gov.bop.rabid.xxx.ui 是RCP 项目。另外两个 Java 项目包含在 rabid RCP 项目中。

我已将这两个 Java 项目作为依赖项添加到我的狂热项目中。

在此处输入图像描述

在此处输入图像描述

当我在 Eclipse 内构建 RCP 产品时,一切都会构建并运行。

当我使用 Eclipse 产品导出向导时,我在 logs.zip 文件中收到以下错误消息:

# 1/13/12 9:02:45 AM EST
# Eclipse Compiler for Java(TM) 0.B61, 3.7.0, Copyright IBM Corp 2000, 2010. All rights reserved.
----------
1. ERROR in C:\BOPEclipse3.7RaBId\gov.bop.rabid.xxx.ui\src\gov\bop\rabid\xxx\ui\video\RabidVideo.java (at line 3)
    import gov.bop.eclipse.logging.EclipseLogging;
           ^^^^^^^^^^^^^^^
The import gov.bop.eclipse cannot be resolved

我知道这是某种依赖性错误,但我无法在我的 RCP 项目中找到位置放置依赖项。

编辑添加:

这是 Rabid 产品依赖项列表的第一部分:

在此处输入图像描述

包括其他两个工作区插件在依赖项列表上。

以下是 Rabid 产品 Eclipse 运行配置插件列表的第一部分:

在此处输入图像描述

回答 Tonny Madsen 的问题 (我很感激您的兴趣):

  • gov.bop.eclipse 日志记录是来自现有 JAR 存档的 Eclipse 插件。
  • com.aware.photocomponent 是来自现有 JAR 存档的 Eclipse 插件。

这是程序包资源管理器,目录已打开:

在此处输入图像描述

与此工作区相关的有 0 个错误和 0 个警告。

I'm working on an Eclipse RCP project on Eclipse 3.6 that's broken up into 3 Java projects.

enter image description here

Starting from the bottom, gov.bop.rabid.xxx.ui is the RCP project. The other two Java projects are included into the rabid RCP project.

I've added these two Java projects as dependencies to my rabid project.

enter image description here

enter image description here

When I build the RCP product inside of Eclipse, everything builds and runs.

When I use the Eclipse product export wizard, I get the following error message in the logs.zip file:

# 1/13/12 9:02:45 AM EST
# Eclipse Compiler for Java(TM) 0.B61, 3.7.0, Copyright IBM Corp 2000, 2010. All rights reserved.
----------
1. ERROR in C:\BOPEclipse3.7RaBId\gov.bop.rabid.xxx.ui\src\gov\bop\rabid\xxx\ui\video\RabidVideo.java (at line 3)
    import gov.bop.eclipse.logging.EclipseLogging;
           ^^^^^^^^^^^^^^^
The import gov.bop.eclipse cannot be resolved

I know that it's some kind of dependency error, but I can't find where in my RCP project to put the dependency.

Edited to add:

Here's the first part of the Rabid product dependencies list:

enter image description here

The two other workspace plugins are included on the dependencies list.

Here's the first part of the Rabid product Eclipse run configuration plug-ins list:

enter image description here

To answer Tonny Madsen's questions (and I appreciate the interest):

  • gov.bop.eclipse logging is an Eclipse plug-in from an existing JAR Archive.
  • com.aware.photocomponent is an Eclipse plug-in from an existing JAR Archive.

Here's the package explorer again, with the directories open:

enter image description here

There are 0 errors and 0 warnings associated with this workspace.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

煮酒 2025-01-02 13:35:27

您收到编译器错误,这意味着 OSGi 解析器对您的依赖项设置感到满意,否则您会在使用未解析的依赖项进行编译之前失败。

我怀疑这与项目中的 .class 文件二进制文件而不是源 .java 文件有关。尝试设置 < gov.bop.eclipse.logging/build.properties 中的 code>output.. 属性是包含带有 .class 文件的包的文件夹的路径(相对于该项目 根)。

如果这些是插件项目,您可以通过右键单击 gov.bop.rabid.xxx.ui/META-INF/MANIFEST.MF 文件并选择 PDE Tools -> 来仔细检查产品导出期间将使用的类路径;创建 Ant 构建文件。这将生成一个 build.xml 文件,您可以检查“@dot”目标以查看正在使用的类路径。

此类问题的其他一些原因(我并不真正认为是这里的情况)是:

  • 清单中的 Bundle-ClassPath 条目不正确。如果未指定,则默认值为“.”,这意味着 .class 文件位于二进制包的根目录中。
  • 在您的包中包含嵌套的 jar,其中一个 jar 依赖于另一个 jar,但没有定义这些 jar 的编译顺序 (jars.compile.order)。

You are getting a compiler error, this implies that the OSGi resolver was happy with your dependency setup, otherwise you would have failed before compilation with an unresolved dependency.

I suspect this is related to having the .class file binaries in the project instead of source .java files. Try setting the output.. property in gov.bop.eclipse.logging/build.properties to be the path to the folder containing packages with the .class files (relative to the project root).

If those are Plug-in Projects, you can double check the classpath that will be used during product export by right clicking on the gov.bop.rabid.xxx.ui/META-INF/MANIFEST.MF file and selecting PDE Tools -> Create Ant Build File. This will generate a build.xml file, you can inspect the "@dot" target to see the classpath being used.

Some other causes of this kind of problem (which I don't really thing are the case here) are:

  • Having an incorrect Bundle-ClassPath entry in the manifest. If not specified, the default value is '.', which means the .class files are in the root of the binary bundle.
  • Having nested jars in your bundle, with one jar depending on the other, but not defining the order in which these jars are compiled (jars.compile.order).
雨后咖啡店 2025-01-02 13:35:27

当我删除 gov.bop.eclipse.logging 插件项目并将 gov.bop.eclipse.logging jar 添加到 gov.bop.rabid.xxx.ui 类路径时,我终于能够构建 Eclipse RCP 包。

日志插件 jar 现在是 ui 插件 jar 的一部分。虽然这“有效”,但如果我想更新日志记录插件 jar,我必须更新 ui 插件 jar。这不是一个优雅的解决方案,只是一个有效的解决方案。

看来这是将外部 Eclipse 插件包含在 Eclipse RCP 包中的唯一方法。我希望有人能证明我错了。

I was finally able to build the Eclipse RCP package when I removed the gov.bop.eclipse.logging plug-in project, and added the gov.bop.eclipse.logging jar to the gov.bop.rabid.xxx.ui classpath.

The logging plug-in jar is now a part of the ui plug-in jar. While this "works", if I want to update the logging plug-in jar, I have to update the ui plug-in jar. This is not an elegant solution, merely an effective solution.

It appears that this is the only way you can include external Eclipse plug-ins in an Eclipse RCP package. I wish someone would prove me wrong.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文