2017-09-07 128 views
0

有一个Eclipse RCP/IDE插件项目依赖于几个Eclipse模块,如org.eclipse.e4.core.diorg.eclipse.core.runtimeeclipse RCP maven/tycho缺少需求'包org.eclipse.e4.core.di'

该项目在提交者环境的Eclipse IDE中进行编译,并使用.target文件进行依赖关系设置。

我想添加一个无头的行家/第谷建立该项目导致的错误如下:

[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是相当大的,并指定所有行家/第谷的插件,用于解决依赖,目标平台和所有插件和特性模块的目标文件。

对于一个失败插件的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> 

我在这里计算器看过不少类似的问题,并试图许多修复:

  • 删除版本tag target/pom.xml,
  • 删除相对路径
  • 使用pom代替eclipse-target-definition
  • 和更多

没有工作。那么我在这里错过了什么?

编辑: 据我了解releng/pom.xml应设置tycho插件和maven的东西。然后执行命令mvn clean verfiy要构建解决方案,而在releng/pom.xml指定Neon.target定义采用target/pom.xmltarget/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中的错字。

+0

你可以在Eclipse * Target Editor *中打开你的'Neon.target'。等到Eclipse解决了目标平台,然后仔细检查* Contents *标签,确定org.eclipse.e4.core.di是否确实包含在目标平台中。 –

+0

好的,你的'Neon.target'确实**包含'org.eclipse.e4.core.di'(只是双重检查自己)。但是,你的'org.myplugin.someservice'插件是否在你的'pom中配置了[target-platform-configuration](https://wiki.eclipse.org/Tycho/Target_Platform#Target_files)Maven插件。 xml'(或其父母之一)? –

+0

我将目标平台配置插件的配置附加为EDIT2。该配置位于org.myplugin.releng的父pom.xml中。 – justwellbrock

回答

0

您将需要运行Maven与-P Neon.target来激活您的<profile>;否则你的target-platform-configuration不会成为构建的一部分。

就个人而言,我会总是有一个默认target-platform-configuration以外的任何<profile>。这可以是,例如,当前版本的Eclipse的目标定义(截至撰写本文时:Oxygen)。我只会使用`不寻常的目标定义,比如较旧的Eclipse版本(在您的情况下:Neon)。但这只是我个人的最佳做法。

-1

其实我解决了我的问题,但不像我预料中的那样。我认为它没有像它应该工作,但这里是它如何工作现在:

我加入org.myplugin.releng/pom.xml父POM以下配置根据答案this question

<repositories> 
    <repository> 
     <id>neon</id> 
     <layout>p2</layout> 
     <url>http://download.eclipse.org/releases/neon/</url> 
    </repository> 
</repositories> 

我之前所做的,但错过了我已经有一个存储库在其他地方的pom.xml部分导致它失败,并在我的愤怒丢失了该轨道:D

其实我仍然认为它应该从目标文件。我注意到在成功的构建中,目标文件在父pom之后被评估,导致在处理目标定义文件之前它需要所有依赖关系。

我敢打赌,我的配置仍然存在问题,但至少现在可以构建。如果有人有任何想法,但它会以某种方式缓解我:)

+0

你是对的:''不应该是必需的; 'eclipse-target-definition'应该完成所有的工作。 “目标文件在父pom”被预期之后评估,但在* building *之前*任何**项目Tycho试图*解决**每个**项目的目标平台。为了做到这一点,所有(尚未构建的)'eclipse-target-definition'项目必须严格遵守[.target'文件的命名约定(https://wiki.eclipse.org/Tycho/Packaging_Types #eclipse-target-definition),这样Tycho就可以在你的项目目录中找到目标文件。 –

相关问题