【发布时间】:2018-02-16 13:53:33
【问题描述】:
有一个 Eclipse RCP/IDE-Plug-in 项目,它依赖于几个 Eclipse 模块,例如 org.eclipse.e4.core.di 或 org.eclipse.core.runtime。
此项目在 Eclipse IDE for Committers 环境中编译,并带有一个用于依赖设置的 .target 文件。
我想为此项目添加一个无头 maven/tycho 构建,导致错误如下:
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: org.myplugin.someservice 1.0.0
[ERROR] Missing requirement: org.myplugin.someservice 1.0.0 requires 'bundle org.eclipse.e4.core.di 0.0.0' but it could not be found
项目设置如下所示:
releng/
org.myplugin.releng/
pom.xml (contains tycho-plugins def, modules, target ref)
org.myplugin.target/
Neon.target
pom.xml (contains 'eclipse-target-definition')
plugins/
org.myplugin.someservice/
pom.xml
META-INF/
MANIFEST.MF (contains reference to org.eclipse.e4.core.di)
我使用了来自 Lars Vogel (http://www.vogella.com/tutorials/EclipseTycho/article.html#exercise-using-a-target-platform-for-the-build) 的教程进行基本设置和理解。
目标文件的内容是:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?><target name="Neon" sequenceNumber="43">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
<unit id="org.eclipse.platform.sdk" version="4.6.3.M20170301-0400"/>
<unit id="org.eclipse.pde.feature.group" version="3.12.3.v20170301-0400"/>
<unit id="org.eclipse.pde.source.feature.group" version="3.12.3.v20170301-0400"/>
<unit id="org.eclipse.platform.ide" version="4.6.3.M20170301-0400"/>
<unit id="org.eclipse.equinox.sdk.feature.group" version="3.12.0.v20170209-1843"/>
<unit id="org.eclipse.rcp.feature.group" version="4.6.3.v20170301-0400"/>
<repository location="http://download.eclipse.org/eclipse/updates/4.6"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
<unit id="org.eclipse.emf.cdo.epp.feature.group" version="4.5.0.v20160607-1511"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="2.12.0.v20160526-0356"/>
<unit id="org.eclipse.emf.compare.diagram.papyrus.feature.group" version="3.2.1.201608311750"/>
<unit id="org.eclipse.xtext.sdk.feature.group" version="2.10.0.v201605250459"/>
<unit id="org.eclipse.gmf.runtime.sdk.feature.group" version="1.10.0.201606071959"/>
<unit id="org.eclipse.gmf.runtime.notation.sdk.feature.group" version="1.10.0.201606071631"/>
<unit id="org.eclipse.uml2.sdk.feature.group" version="5.2.3.v20170227-0935"/>
<unit id="org.eclipse.emf.compare.ide.ui.feature.group" version="3.2.1.201608311750"/>
<repository location="http://download.eclipse.org/releases/neon"/>
</location>
</locations>
</target>
这主要捕获了我的 Eclipse 安装信息打印出的有关已安装软件的内容。
target/pom.xml 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.myplugin</groupId>
<artifactId>org.myplugin.releng</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../org.myplugin.releng/pom.xml</relativePath>
</parent>
<groupId>org.myplugin</groupId>
<artifactId>org.myplugin.target</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-target-definition</packaging>
</project>
releng/pom.xml 相当大,它指定了所有 maven/tycho 插件、用于依赖解析的目标文件、目标平台以及作为模块的所有插件和功能。
对于一个失败的插件,pom.xml 文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.myplugin</groupId>
<artifactId>org.myplugin.releng</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../org.myplugin.releng/pom.xml</relativePath>
</parent>
<groupId>org.myplugin</groupId>
<artifactId>org.myplugin.someservice</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
我在 stackoverflow 上阅读了许多类似的问题,并尝试了许多修复:
- 移除版本标签target/pom.xml,
- 删除相对路径,
- 使用 pom 代替 eclipse-target-definition
- 还有更多
没有任何效果。那么我在这里错过了什么?
编辑:
据我了解,releng/pom.xml 应该设置 tycho 插件和 maven 的东西。然后执行mvn clean verfiy 命令应该构建解决方案,而releng/pom.xml 中指定的Neon.target 定义采用target/pom.xml 和target/Neon.target 来获取Eclipse 环境(包括org.eclipse.e4.core.di 和org.eclipse.core 东西)以及任何进一步定义依赖关系。
EDIT2:
我的eclipse-target-definition 插件是这样配置的:
<profile>
<id>Neon.target</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<xtext-version>2.10.0</xtext-version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<includePackedArtifacts>true</includePackedArtifacts>
<target>
<artifact>
<groupId>org.myplugin</groupId>
<artifactId>org.myplugin.target</artifactId>
<version>1.0.0-SNAPSHOT</version>
<classifier>org.myplugin.target</classifier>
</artifact>
</target>
</configuration>
</plugin>
</plugins>
</build>
</profile>
EDIT3:我使用的是第谷版本 1.0.0
EDIT4 修正了target/pom.xml 中的一个错字。
【问题讨论】:
-
你能在 Eclipse Target Editor 中打开你的
Neon.target。等到 Eclipse 解析了目标平台,然后在 Contents 选项卡上仔细检查org.eclipse.e4.core.di是否确实包含在您的目标平台中。 -
好的,你的
Neon.target确实确实包含org.eclipse.e4.core.di(我自己仔细检查了一遍)。但是您的org.myplugin.someservice插件是否在其pom.xml(或其父级之一)中配置了target-platform-configuration Maven 插件? -
我将目标平台配置插件的配置附加为 EDIT2。此配置位于 org.myplugin.releng 的父 pom.xml 中。
-
三个备注:首先,
org.myplugin.target的<classifier>看起来不对;org.myplugin.targetPOM 中的 AFAICT,.target文件在没有分类器的情况下部署(在~/.m2/repository/中仔细检查)。 第二,你的.target文件真的叫org.myplugin.target.target吗? Tycho expects it to be named{project.artifactId}.target。 第三,Neon.target配置文件在构建时是否处于活动状态? (使用mvn help:active-profiles或mvn help:effective-pom进行检查。) -
好的,所以:首先:我不知道分类器还必须在
org.myplugin.targetPOM 中指定。我在哪里可以读到这个? (从org.myplugin.relengPOM 中删除它仍然失败)第二:{project.artifactId}是org.myplugin.target,其目标文件称为org.myplugin.target.target(是的,它很难看)第三:这些命令失败,并出现相同的Missing Requierement ...错误。
标签: java eclipse maven rcp tycho