是否可以从p2 repo解析maven插件中的依赖关系 [英] Is it possible to resolve dependencies in maven plugin from p2 repo

查看:319
本文介绍了是否可以从p2 repo解析maven插件中的依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个maven插件,它将用于覆盖默认的maven生命周期,并将使用我的代码。我有多个jar依赖(eclipse和我的另一个应用程序插件)相同。我有p2回购这些罐子。如何整合这两个来解决所有依赖关系?
不能使用Tycho,因为它只能用于RCP应用程序(我的理解/误解)。



与此类似 - 问题



任何其他解决方法?

解决方案

你看过这个git吗?
https://github.com/reficio/p2-maven-plugin
看起来像你想要实现的。



它还说明了插件的最佳做法:



  • 不要使用Tycho的pomDependencies->考虑选项,因为它只是不好

  • 不要定义你的pom.xml的依赖关系部分中的外部依赖项(mvn编译将在控制台中使用,但在导入项目时它不会在Eclipse IDE中工作,因为目标配置对于在此定义的依赖关系一无所知) / li>
  • 使用MANIFEST-FIRST方法 - 在MANIFEST.MF文件中定义所有依赖项。

  • 如果您的某些依赖关系不是OSGi软件包或在P2更新站点中不可用,SIMPLY在p2-maven-plugin配置中定义它们,生成站点并使用jetty(或任何第o呃机制)。然后将暴露站点的URL添加到目标平台定义。在这样一种方式下,您将在Eclipse RCP项目中拥有一致的,明显的依赖关系管理!

  • 每当您必须添加另一个外部依赖关系时,只需重新调用mvn p2:site并且该网站将被重新生成。

  • 您可以使用Jenkins和Apache2自动生成/展示我们的网站



I am developing one maven plugin which will be used to override the default maven lifecycles and will use my code instead. I have multiple jar dependencies (eclipse and my another application plugins) for the same. I have p2 repo for those jars. How can I integrate this two to resolve all dependencies? Tycho can not be used as it can only be used for RCP application (my understanding / misunderstanding).

Similar to this - question

Any other workaround?

解决方案

Have you had a look at this git ? https://github.com/reficio/p2-maven-plugin Looks like what you are trying to achieve.

It also states the best practices of the plugin:

  • DO NOT to use the Tycho's pomDependencies->consider option as it is simply of NO good
  • DO NOT define your external dependencies in the dependencies section of the pom.xml (mvn compilation will work in the console, but it will not work in the Eclipse IDE when you import the project, since the 'Target Configuration' knows nothing about the dependencies defined there)
  • Use the MANIFEST-FIRST approach - define all your dependencies in the MANIFEST.MF files.
  • If some of your dependencies are not OSGi bundles or are not available in P2 update sites, SIMPLY define them in the p2-maven-plugin config, generate the site and make it available using jetty (or any other mechanism). Then add the URL of the exposed site to the target platform definition. In such a way you will have a consistent, manifest-first dependency management in Eclipse RCP project!
  • Whenever you have to add another external dependency, simply re-invoke "mvn p2:site" and the site will be regenerated.
  • You can automate the generation/exposition of our site using for example Jenkins and Apache2

这篇关于是否可以从p2 repo解析maven插件中的依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆