如何使用Maven中的Eclipse p2存储库? [英] How can I use Eclipse p2 repositories from Maven?

查看:300
本文介绍了如何使用Maven中的Eclipse p2存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个基于Eclipse的安装程序,其中Eclipse项目是基于Maven的.因此,无论是否使用Eclipse,它都应该与Maven一起使用.

I am trying to create an Eclipse based setup where Eclipse projects are Maven based. So it should all work with Maven whether or not Eclipse is used.

我对各种Eclipse项目库都有依赖关系,还有更多要添加的内容.我想使用p2存储库,并设法按照以下示例将Eclipse EMF库转换为jar:

I have a dependencies on various Eclipse project libraries, with more to be added. I want to use p2 repositories, and I've managed to pull an Eclipse EMF library and turn it into a jar following this example: Use dependencies from Eclipse p2 repository in a regular Maven build?

问题是,我找不到简化流程的方法.我需要手动将上述问题中重新打包的依赖项安装到本地Maven存储库中,以便我可以在其他项目中引用它.我想将p2存储库中的工件无缝集成到基于Maven的设置中. m4e看起来不是我想要的平滑解决方案:理想情况下,我想分发一组目录,这些目录将响应简单的mvn全新安装而完成所有工作:从p2存储库中提取库,从Maven存储库中提取其他库等等.

The problem is, I could not find a way of streamlining the process. I'd need to manually install the re-packaged dependency from the question given above to local Maven repository so that I can reference that in other projects. I'd like to seamlessly integrate artefacts from p2 repositories to my Maven based setup. m4e does not look like the smooth solution I'm looking for: Ideally I'd like to distribute a set of directories which would do everything in response to a simple mvn clean install : pull libraries from p2 repo, pull other libraries from Maven repositories etc..

通过Maven和Tycho集成可以做到这一点吗?

Is this doable via Maven and Tycho integration?

更新:首先,澄清问题:仅能够引用P2存储库并不能解决需要从另一个项目中使用此引用的情况.从P2存储库引用的一个或多个库必须重新打包为jar,以便其他Maven项目可以引用.所引用的问题进行包装.但是,它没有说明如何从其他项目中使用此重新打包的输出(程序集).就我而言,这是从聚集的POM引用程序集,并为所有希望使用具有P2存储库来源的库的项目继承POM的形式.

Update: first, clarification to the question: just being able to reference to P2 repositories does not help with the scenario where this reference needs to be used from another project. The library (or libraries) referenced from P2 repository must be re-packaged as a jar so that it can be referenced by other Maven projects. The referenced question does the packaging. However, it does not explain how this repackaged output (assembly) can be used from other projects. In my case, this turned out to be referencing the assembly from an aggregating POM, and inheriting form that POM for all projects that would like to use the library with the P2 repository origin.

推荐答案

解决方案是使用Maven创建一个多模块设置,并声明对EMF库重新包装输出的依赖性(来自我所引用的问题) )所有项目的父pom具有以下内容:

The solution is to create a multi module setup with Maven, and declare a dependency on the outputs of EMF library re-packaging (from the question I've referenced) The parent pom for all projects has this:

    <dependencies>
    <dependency>
        <groupId>com.mymodule</groupId>
        <artifactId>myartifact</artifactId>
        <version>0.0.1</version>
        <classifier>repackaged</classifier>                 
    </dependency>
  </dependencies>
      <modules>
            <module>../mymodule</module>
     </modules>

哪个可以让所有具有此模块的模块作为父级来访问重新包装的P2工件.

Which lets all modules that has this module as parents access the repackaged P2 artifacts.

这篇关于如何使用Maven中的Eclipse p2存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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