Is it possible to resolve dependencies in maven plugin from p2 repo

谁都会走 提交于 2019-12-23 07:05:56

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/38099426/is-it-possible-to-resolve-dependencies-in-maven-plugin-from-p2-repo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!