Eclipse平台中的循环依赖 [英] Circular Dependencies in Eclipse Platform

查看:396
本文介绍了Eclipse平台中的循环依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将Eclipse平台添加到我的Maven项目中,但偶然发现了一些非常奇怪的东西.

I'm trying to add the Eclipse Platform to my Maven project and stumbled over something very weird.

有一个插件

There is the plug-in org.eclipse.swt, which has a dependency org.eclipse.swt.${osgi.platform}, where ${osgi.platform} can be any of the following:

  • cocoa.macosc.cocoa
  • gtk.linux.aarch64
  • win32.win32.x86_64
  • cocoa.macosc.cocoa
  • gtk.linux.aarch64
  • win32.win32.x86_64

但是,如果您检查pom.xml . win32.x86_64/3.108.0/org.eclipse.swt.win32.win32.x86_64-3.108.0.pom"rel =" nofollow noreferrer> org.eclipse.swt.win32.win32.x86_64 您会发现该项目与org.eclipse.swt.这形成了一个很好的依赖关系圈,这在Maven和OSGi中都是不允许的.

However if you check the pom.xml of org.eclipse.swt.win32.win32.x86_64 you learn that this project has a dependency to org.eclipse.swt. Which forms a nice dependency circle, which is not allowed in Maven nor in OSGi.

因此,我得到一个StackOverflowError,但是仅当我尝试将maven-dependency-plugin-Dosgi.platform=win32.win32.x86_64一起使用时.

Consequently I'm getting a StackOverflowError, but only if I try to use the maven-dependency-plugin with -Dosgi.platform=win32.win32.x86_64.

如果我不使用该参数,则会出现以下异常:

If I don't use that parameter I get the following exception:

No versions available for org.eclipse.platform:org.eclipse.swt.gtk.linux.aarch64:jar:[3.105.2,3.105.2]

(可能还可以,因为我想Linux是默认值,但是由于我有Windows PC,它不适用于我.)

(Which is probably okay, because I guess that Linux is the default value, but it doesn't apply to me, since I've got a Windows PC.)

我也不能排除依赖项,例如与:

I can't exclude the dependency either, e.g. with:

        <dependency>
            <groupId>org.eclipse.platform</groupId>
            <artifactId>org.eclipse.swt</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.platform</groupId>
                    <artifactId>org.eclipse.swt.gtk.linux.aarch64</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

通过这种方法,我会收到与上面相同的错误消息.

I get the same error messages as above with that approach.

我想知道Eclipse伙计们是如何设法释放这种混乱的,但是更重要的是:如何针对具有这种循环依赖关系的Maven项目进行构建?

I'm wondering how the Eclipse guys even managed to release that mess, but more importantly: How do I build against a Maven project with circular dependencies like this?

推荐答案

您在找错地方. Eclipse工件发布在Eclipse p2存储库中.此外,一些 Eclipse工件将发布在 Maven存储库中,以用于普通(非基于Eclipse的)Java应用程序中,而这些Java应用程序不能用于构建基于Eclipse的应用程序.将Eclipse SWT发布到Maven Central似乎出现了问题,导致了循环依赖.请将此报告给Eclipse.

You're looking at the wrong place. Eclipse artifacts are published in Eclipse p2 repositories. In addition, some Eclipse artifacts will be published in Maven repositories for use in plain (non-Eclipse based) Java applications which cannot be used to build Eclipse-based applications. Something seems to have gone wrong publishing Eclipse SWT to Maven Central causing the circular dependencies. Please report this to Eclipse.

Eclipse IDE软件包是使用 Maven插件 Tycho .例如,请参阅Eclipse平台的 pom.xml文件或此处的父级pom.xml用于所有IDE软件包. Tycho使用一个或多个Eclipse p2存储库来解决依赖关系.例如,Maven存储库将无法解决依赖关系或产品配置.在Maven存储库中,工件具有版本,而在p2存储库中,同一JAR的Java软件包也可以具有不同的版本.在Maven Tycho pom.xml中,仅需指定p2存储库,相关性已在META-INF/MANIFEST.MFfeature.xml*.product文件中声明.

The Eclipse IDE packages are built with the Maven plug-in Tycho. See for example the pom.xml file for the Eclipse platform or here the parent pom.xml for all IDE packages. Tycho uses one or more Eclipse p2 repositories to resolve dependencies. A Maven repository would not work to resolve Import-Package dependencies or product configurations, for example. In a Maven repository, an artifact has a version, while in a p2 repository also Java packages of the same JAR can have different versions. In a Maven Tycho pom.xml only the p2 repositories have to be specified, the dependencies are already declared in the META-INF/MANIFEST.MF, feature.xml and *.product files.

这篇关于Eclipse平台中的循环依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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