0

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.

8
  • Can you open your Neon.target in the Eclipse Target Editor. Wait till Eclipse has resolved the target platform and then double-check on the Contents tab whether org.eclipse.e4.core.di is indeed included in your target platform. Sep 8, 2017 at 14:55
  • OK, your Neon.target really does contain org.eclipse.e4.core.di (just double-checked myself). But does your org.myplugin.someservice plug-in have you the target-platform-configuration Maven plug-in configured in its pom.xml (or one of its parents)? Sep 8, 2017 at 15:19
  • I appended the configuration of the target-platform-configuration plugin as EDIT2. This config is in the parent pom.xml from org.myplugin.releng. Sep 8, 2017 at 15:57
  • Three remarks: First, the <classifier> of org.myplugin.target looks wrong; AFAICT from the org.myplugin.target POM, the .target file is deployed without a classifier (double-check this in your ~/.m2/repository/). Second, is your .target file really called org.myplugin.target.target? Tycho expects it to be named {project.artifactId}.target. Third, is the Neon.target profile active when building? (Use mvn help:active-profiles or mvn help:effective-pom to check.) Sep 9, 2017 at 7:12
  • Ok, so: First: I didn't know that the classifier has to be also specified in the org.myplugin.target POM. Where can I read this up? (After removing it from org.myplugin.releng POM it still fails) Second: The {project.artifactId} is org.myplugin.target, the target file therefor is called org.myplugin.target.target (yeah, it's ugly) Third: It fails with these commands with the same Missing Requierement ... error. Sep 11, 2017 at 9:55

2 Answers 2

1

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.

-1

Actually I solved my problem, but not like I would have expected. I assume it is not like it should work but here is how it works now:

I added to the org.myplugin.releng/pom.xml parent pom the following config according to the answer to this question:

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

I did that before, but missed that I already had a repositories section elsewhere in the pom.xml which caused it to fail and got lost of that track in my rage :D

Actually I still believe that it should get that information from the target file. I noticed on the successful build, that the target file is evaluated after the parent pom leading to the situation that it requires all dependencies before even processing the target definition file.

I bet something is still wrong with my configuration, but at least it builds now. If someone has any idea though it would relief me somehow :)

1
  • You are right: The <repository> should not be necesary; the eclipse-target-definition should do all the work. “[T]hat the target file is evaluated after the parent pom” is to be expected, but before building any projects Tycho tries to resolve the target platform of every project. In order to do that, all (not yet built) eclipse-target-definition projects must strictly adhere to the naming convention for the .target file so that Tycho can locate the target file in your project directory. Sep 9, 2017 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.