4

我正在尝试创建一个 Eclipse 插件,它依赖于普通的 Maven 工件。我创建了以下项目结构:

Parent POM
 |- Dependencies (Third Party)
 \- My Code
     |- Bundle
     \- Bundle Tests

我遵循了 Tycho 示例 itp02,但仅使用了第三方依赖项。据我了解,这个想法是将所有依赖项包装在一个包中,并将其用作我的包的输入。我设法正确构建和安装依赖包:创建了一个 jar,它包含从 Maven 存储库获得的所有 JAR 文件。但是当我尝试编译我的包时,我收到一条错误消息,说我的包清单中的包无法导入。

[ERROR]   Missing requirement: MyPlugin 0.0.1.qualifier requires 'package org.apache.commons.lang.StringEscapeUtils 0.0.0' but it could not be found
[ERROR] 
[ERROR] Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from MyPlugin 0.0.1.qualifier to package org.apache.commons.lang.StringEscapeUtils 0.0.0.", "No solution found because the problem is unsatisfiable."] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from MyPlugin 0.0.1.qualifier to package org.apache.commons.lang.StringEscapeUtils 0.0.0.", "No solution found because the problem is unsatisfiable."]

我错过了什么?

4

1 回答 1

5

从您的描述中,您的项目是如何设置的或您用于构建它的命令不是很清楚。但是,您的“POM 父母”似乎建议您尝试一次性构建它。如果是这种情况,您不能在同一构建中混合使用 pom-first (maven-bundle-plugin) 项目和 manifest-first (eclipe-plugin) 项目,请参阅 [1]。您需要先构建 pom-first 项目并将其安装到本地 maven 存储库中,然后才能构建 manifest-first 项目。

要检查的第二件事是您配置了正确的依赖项,并且您已设置 pomDependencies=consider,如 [2] 中所示。

最后,如果这没有帮助,请检查本地 maven 存储库中的 jar 文件是否具有 META-INF/MANIFEST.MF 和正确的“Export-Package”语句 - 特别是应该有一行 org.apache.commons。 lang.StringEscapeUtils。

[1] http://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts#It_is_not_possible_to_mix_pom-first_and_manifest-first_projects_in_the_same_reactor_build

[2] http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp02/build02/pom.xml

于 2012-07-30T13:14:43.513 回答