Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Tycho Target Platform Question

Hi Tycho Users, Developers,

I have an old plugin based on Tycho 0.11.0 which added support for a custom eclipse project type that is similar to an eclipse-plugin in the way it manages dependencies. I have upgraded it to use Tycho 0.24.0, and for the most part everything works as I expect, except one thing.

In my project's that use the plugin (with custom packaging type ’tigerstripe-module’), I have a number of dependencies (Eclipse Features/Plugins) to resolve. 

What I have found, is that if I have a Target file configured to install a few of the plugins, and the rest configured as POM dependencies, that I have to define the P2 location’s where each dependencies are available in both locations, even though all of the artifacts are available in Maven Repositories.

Target file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.6"?>
<target name="Tigerstripe">
<locations>
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
<unit id="org.eclipse.tigerstripe.workbench.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
<unit id="com.cisco.xmp.sdk.contrib.tsmodel.feature.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
</location>
</locations>
</target>

Pom File:
<repositories>
<repository>
<id>eclipse</id>
<layout>p2</layout>
</repository>
<repository>
<id>customizations</id>
<layout>p2</layout>
</repository>
<repository>
<id>model</id>
<layout>p2</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.cisco.xmpim.build</groupId>
<artifactId>com.cisco.xmpim.customizations.feature</artifactId>
<version>${customizations.version}</version>
<type>eclipse-feature</type>
</dependency>
<dependency>
<groupId>[redacted]</groupId>
<artifactId>xmp-im-foundation-module</artifactId>
<version>${models.version}</version>
</dependency>
</dependencies>
       [[ Target File is attached, and target-platform-configuration is configured, but not shown ]]

If I do not add the Mars url to both locations than Tycho fails to resolve the transitive dependencies coming from the unit’s given in the respective files. That is, The dependency ‘com.cisco.xmpim.customizations.feature’ has transitive dependencies to Eclipse plugins found in Mars repository, and so does installable unit ‘org.eclipse.tigerstripe.workbench.feature.group’ found in the Target file. To make it more confusing to me, the POM dependency ‘com.cisco.xmpim.customizations.feature’ also has a dependency to ‘org.eclipse.tigerstripe.workbench.base’, which is pulled by the installable unit ‘org.eclipse.tigerstripe.workbench.feature.group’ from the Target file, yet I do not have to define the URL for the Tigerstripe update site in both locations.

In my custom Tycho Project I have extended the TychoProject to handle ‘eclipse-feature’ dependencies as follows - TigerstripeProject.java:

@Component(role = TychoProject.class, hint = "tigerstripe-module")
public class TigerstripeProject extends OsgiBundleProject implements TychoProject {

    @Override
    public void readExecutionEnvironmentConfiguration(MavenProject project, ExecutionEnvironmentConfiguration executionEnvironmentConfiguration) {
      
        TargetPlatformConfiguration config = TychoProjectUtils.getTargetPlatformConfiguration(project);
        for (Dependency extra :  project.getDependencies()) {
    if (extra.getType().equals(ArtifactType.TYPE_ECLIPSE_FEATURE)) {
                Dependency dep = new Dependency();
                dep.setArtifactId(extra.getArtifactId() + ".feature.group");
                dep.setType(ArtifactType.TYPE_INSTALLABLE_UNIT);
                dep.setVersion(extra.getVersion());
                config.addExtraRequirement(dep);
            }
        }
      
super.readExecutionEnvironmentConfiguration(project, executionEnvironmentConfiguration);
    }
}

My questions are:
  1. According to the Target Platform guide - https://wiki.eclipse.org/Tycho/Target_Platform - Both <repositories> and Target file configuration are supposed to contribute to the candidate Target Platform. If this is the case, than why do I need to give the Mars URL in both locations? It seems Tycho resolves from both locations to create the target platform, but does not share information between the two during the resolution process?
  2. What is considered an ‘OSGI Bundle’? Shouldn’t Tycho automatically add dependencies configured in the POM to the candidate Target Platform when <pomDependencies>consider</pomDependencies> is configured, and <dependency> types are: eclipse-plugin, eclipse-feature, eclipse-product, or p2-installable-unit? If I try to remove my custom code to add the extra requirements to the Platform Configuration than Tycho throws an error that the dependencies could not be resolved. Same things happen if I remove the repository URL to the P2 Site that they can be found at.
I seem to be missing some basic understanding about when Tycho will download dependencies from the Configured Maven Repository, and when it will download them from configured P2 Repositories.

The reason that I want both POM dependencies and a Target file, is the Target file I do not expect to change much, and I want to just set-up a template once for users to use across all projects, but the dependencies mentioned in the POM change often and are project specific.

Any help or pointers is greatly appreciated!

Thanks,
Daniel

Attachment: Screen Shot 2015-12-08 at 4.56.23 PM.png
Description: Screen Shot 2015-12-08 at 4.56.23 PM.png


Back to the top