【发布时间】:2013-07-25 10:32:31
【问题描述】:
我正在构建一个产品(在 eclipse-repository 模块中),其中包含几个功能,这些功能通过 p2.inf 文件创建的可安装单元配置其插件。
只要我为tycho-p2-director-plugin 的source 配置参数使用默认值targetPlatform,它就可以工作。 AFAIK 这使得导演可以访问来自<project_dir>/target/targetPlatformRepository/context.xml 的 p2 元数据以及来自本地 Maven 存储库的工件。
由于我想修改一些捆绑包,我将source 参数更改为repository。这使得导演使用 <project_dir>/target/repository 中生成的存储库中的工件和元数据并破坏我的构建;-)
<project_dir>/target/repository/content.jar 中似乎缺少通过 p2.inf 创建的可安装单元,而 <project_dir>/target/targetPlatformRepository/context.xml 是完整的。例如。以下单元仅包含在后者中:
<unit id='configure.org.sample.bundle' ...>
<!-- config -->
</unit>
如何配置构建以在 project/repository/content.jar 中也包含该可安装单元?
这是我的 p2.inf 文件的 sn-p:
# org.sample.bundle
requires.0.namespace=org.eclipse.equinox.p2.iu
requires.0.name=configure.org.sample.bundle
requires.0.greedy=true
units.0.id=configure.org.sample.bundle
units.0.version=1.0.0
units.0.provides.1.namespace=org.eclipse.equinox.p2.iu
units.0.provides.1.name=configure.org.sample.bundle
units.0.provides.1.version=1.0.0
units.0.instructions.install=org.eclipse.equinox.p2.touchpoint.eclipse.installBundle(bundle:${artifact});
units.0.instructions.configure=org.eclipse.equinox.p2.touchpoint.eclipse.setStartLevel(startLevel:2); org.eclipse.equinox.p2.touchpoint.eclipse.markStarted(started:true);
units.0.hostRequirements.1.namespace=osgi.bundle
units.0.hostRequirements.1.name=org.sample.bundle
units.0.hostRequirements.1.greedy=false
units.0.hostRequirements.2.namespace=org.eclipse.equinox.p2.eclipse.type
units.0.hostRequirements.2.name=bundle
units.0.hostRequirements.2.range=[1.0.0,2.0.0)
units.0.hostRequirements.2.greedy=false
units.0.requires.1.namespace=osgi.bundle
units.0.requires.1.name=org.sample.bundle
units.0.requires.1.greedy=false
以及来自 Tycho 构建的错误:
Cannot complete the install because one or more required items could not be found.
Software being installed: sample 1.0.0.201308060715 (sample.product 1.0.0.201308060715)
Missing requirement: Sample Feature 1.0.0.201308060715 (sample.feature.feature.group
1.0.0.201308060715) requires 'configure.org.sample.bundle 0.0.0' but it could not be found
【问题讨论】:
-
“我想修改一些捆绑包...” - 这似乎是错误的。我不知道您要达到什么目的,但是使用
source=repository在其模块构建之外修改捆绑包不是一个合适的解决方案。 -
首先感谢您再次回答我的问题:-)。修改仅包括对捆绑包进行签名。所以我想这闻起来没有你最初想象的那么强烈。知道为什么生成的 p2 存储库中的可安装单元不完整吗?
-
您是否将您的project.build.directory 更改为
project?通常路径是target/repository/,target/targetPlatformRepository/, ... -
对不起,我的意思是
/target/... 编辑了路径。