Search code examples
javaeclipsemavenrcptycho

eclipse RCP maven/tycho missing requirement 'bundle org.eclipse.e4.core.di'


There is an Eclipse RCP/IDE-Plug-in project which depends on several Eclipse Modules like org.eclipse.e4.core.di or org.eclipse.core.runtime.

This project compiles in a Eclipse IDE for Committers environment with a .target file for dependency setup.

I want to add a headless maven/tycho build for this project resulting in errors as follows:

[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

The project setup looks like this:

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)

I've used the Tutorial from Lars Vogel (http://www.vogella.com/tutorials/EclipseTycho/article.html#exercise-using-a-target-platform-for-the-build) for the base setup and understanding.

The contents of the target file are:

<?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>

This catches mostly what my Eclipse Installation Information prints out about the installed software.

The target/pom.xml looks like this:

<?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>

The releng/pom.xml is quite big and specifies all maven/tycho plugins, the target file to use for dependency resolution, target platforms and all plugins and features as modules.

For one failing plugin the pom.xml file looks like this:

<?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>

I've read many similar question here on stackoverflow and tried many of the fixes:

  • removing the version tag target/pom.xml,
  • removing the relative path,
  • using pom instead of eclipse-target-definition
  • and some more

Nothing worked. So what am I missing here?

EDIT: As I understood the releng/pom.xml should setup tycho plugins and maven stuff. Executing the mvn clean verfiy command should then build the solution while the specified Neon.target definition in releng/pom.xml takes the target/pom.xml and target/Neon.target to get the Eclipse Environment (including org.eclipse.e4.core.di, and org.eclipse.core stuff) plus any further defined dependencies.

EDIT2: My eclipse-target-definition plugin is configured like this:

<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: I'm using Tycho Version 1.0.0

EDIT4 Fixed a typo in target/pom.xml.


Solution

  • You will need to run Maven with -P Neon.target to activate your <profile>; otherwise your target-platform-configuration won’t be part of the build.

    Personally, I would always have a default target-platform-configuration outside any <profile>. This could be, e.g., a target definition for the current release of Eclipse (as of this writing: Oxygen). I would only use ` for unusual target definitions like older Eclipse releases (in your case: Neon). But that’s just my personal best practice.