Maven多模块中针对Tycho的自定义pom.xml文件名 [英] Custom pom.xml filename in Maven multimodule for Tycho

查看:101
本文介绍了Maven多模块中针对Tycho的自定义pom.xml文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,其中包含数十个Eclipse插件,所有这些插件都是相互关联的,并且位于不同的子文件夹中.几年前,该版本已转换为多模块清单式第一个Tycho版本,并且运行良好.

I have a project with a couple of dozen Eclipse plugins, all inter-related and living in different subfolders. The build was converted to a multi-module manifest-first Tycho build a couple of years ago and it works quite well.

其中一个插件很关键,也可以构建为不使用Eclipse运行时的独立Java应用程序.当前,它具有自己的POM文件(pom-standalone.xml),因此Jenkins可以单独构建独立的应用程序,而Tycho版本对此一无所知-pom-standalone仅列出了先前构建的插件jar(感谢Tycho!)和Eclipse库.它需要作为依赖项.但是,这种方法存在一些问题:

One of the plugins is rather key, and can also be built as a standalone Java app, which doesn't use an Eclipse runtime. Currently it has its own POM file (pom-standalone.xml) so that Jenkins can build the standalone app separately and the Tycho build knows nothing about it - the pom-standalone just lists the previously-built plugin jars (thanks Tycho!) and Eclipse libraries that it needs as dependencies. Couple problems with this approach though:

  • 我无法轻松地使用IntelliJ在带有Maven依赖项管理的独立项目上工作,因为它无法将自定义的pom-standalone.xml文件名识别为POM.

  • I cannot easily use IntelliJ to work on the standalone project with Maven dependency management, because it doesn't recognize the custom pom-standalone.xml filename as a POM.

  • 该项目所依赖的许多jar都是为了Tycho和Eclipse Manifest文件而签入项目的,但是它们也由Maven管理以进行独立构建.因此,必须将所有依赖项添加到pom-standalone.xml文件中,并输入到OSGi清单中,并为了Eclipse的目的而签入源代码控件.
  • The many jars that this project relies on are checked in to the project for the sake of Tycho and the Eclipse Manifest file, but they're also managed by Maven for the standalone build. So any dependencies have to be added to the pom-standalone.xml file AND entered into the OSGi manifest AND checked in to the source control for Eclipse purposes.

似乎一个简单的解决方法是告诉Tycho/模块对子模块的POM或也许对所有多模块POM文件使用pom.xml以外的其他东西,因为Eclipse无论如何都不会使用这些文件-那么可以转换为pom.xml,然后IntelliJ就可以了.

It seems like a straightforward workaround would be to tell Tycho/modules to use something other than pom.xml for the submodule's POM, or perhaps all the multimodule POM files, since Eclipse doesn't use those anyway - then the pom-standalone.xml can be converted to pom.xml and then IntelliJ will be fine with it.

我知道您可以为Maven构建指定-f属性,但是这真的适用于所有子模块吗?您可以仅为一个子模块指定POM文件名吗?

I know you can specify the -f attribute to Maven builds, but will that really apply to all submodules? Can you specify the POM filename for just ONE submodule?

有替代解决方案吗? Eclipse/Tycho/p2构建似乎有些麻烦,需要手动进行库管理并检入库以进行源代码控制,但是最近几年在Eclipse构建世界中我可能还没有意识到一些变化.

Are there alternative solutions? Eclipse/Tycho/p2 builds seem somewhat of a headache requiring manual library management and checking in libraries to source control, but maybe there have been changes I'm not aware of in the Eclipse build world the last few years.

找到了类似问题,并没有太大帮助

Found a Similar Question that didn't help much.

推荐答案

通过使用自定义名称为POM文件指定全名,可以将项目包括在聚合器POM中.示例:

You can include projects in an aggregator POM by specifying the full name to the POM file with custom name. Example:

<modules>
    <module>org.example.bundle1</module>
    <module>org.example.bundle2</module>
    <module>org.example.keybundle/pom-tycho.xml</module>
</modules>

这两者都可以在纯Maven和Maven/Tycho构建中使用.

This both works in a pure Maven and Maven/Tycho build.

这篇关于Maven多模块中针对Tycho的自定义pom.xml文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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