以编程方式配置p2更新存储库 [英] Configure a p2 update repository programmatically
本文介绍了以编程方式配置p2更新存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Eclipse wiki中有一篇文章如何通过向您的产品添加静态配置文件来配置用户的p2默认存储库:
There is an article in the Eclipse wiki how to configure user's p2 default repositories of an RCP application by adding a static conf file to your product:
Equinox / p2 /将自更新添加到RCP应用程序 - 配置用户的默认存储库
当用户更改某些配置详细信息时,我想在Java类中以编程方式执行相同操作。我找不到合适的p2 API文档。
I want to do the same programmatically in a Java class when the user changes some configuration details. I could not find appropriate p2 API documentation for that.
推荐答案
我找到了一个解决方案。这很容易 - 遗憾的是没有文档......
I found a solution. It's easy - unfortunately there is no documentation...
// from bundle org.eclipse.equinox.p2.console
import org.eclipse.equinox.internal.p2.console.ProvisioningHelper;
URI repoUri = new URI(UPDATE_SITE_URL);
try {
ProvisioningHelper.addMetadataRepository(repoUri);
} catch( Exception e ) {
LOG.warn("Can not add update repository: " + repoUri);
}
try {
ProvisioningHelper.addArtifactRepository(repoUri);
} catch( Exception e ) {
LOG.warn("Can not add update repository: " + repoUri);
}
这篇关于以编程方式配置p2更新存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文