Using Tycho, how do I build a Feature that includes other Features that I have built and deployed on my p2 repository

StackOverflow https://stackoverflow.com/questions/21294786

Question

I want to build a Feature that is made up only of other Features that I have also built using Tycho.

So, lets say the aggregator Feature is com.myurl.feature.agg

In its feature.xml file, I have a couple of entries that look like this...

<feature>

    ...

   <includes
     id="com.myurl.feature.foo"
     version="1.0.12.qualifier"
     search-location="both"/>

   <includes
     id="com.myurl.feature.bar"
     version="1.1.4.qualifier"
     search-location="both"/>
</feature>

The two features included are successfully built and reside on a p2 repository that I have access to and have verified that works fine.

My pom file for the com.myurl.feature.agg has the necessary reference to the p2 repository, and I can see that it finds the included features successfully because the output from the mvn clean install command... shows that is is "fetching" what looks like the correct bundles that make up the features com.myurl.feature.foo and com.myurl.feature.bar.

But, shortly after that I get this error.

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: com.myurl.feature.agg.feature.group 1.1.5.qualifier
[ERROR]   Missing requirement: com.myurl.feature.agg.feature.group 1.1.5.qualifier requires 'com.myurl.feature.bar.feature.group [1.1.4,1.1.5)' but it could not be found
[ERROR]
[ERROR] Internal error: java.lang.RuntimeException: No solution found because the problem is unsatisfiable.: [Unable to satisfy dependency from com.myurl.feature.agg.feature.group 1.1.5.qualifier to com.myurl.feature.bar.feature.group [1.1.4,1.1.5).; No solution found because the problem is unsatisfiable.] ->
[Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: No solution found because the problem is unsatisfiable.: [Unable to satisfy dependency from com.myurl.feature.agg.feature.group 1.1.5.qualifier to com.myurl.feature.bar.feature.group [1.1.4,1.1.5).; No solution found because the problem is unsatisfiable.]
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:164)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.RuntimeException: No solution found because the problem is unsatisfiable.: [Unable to satisfy dependency from com.myurl.feature.agg.feature.group 1.1.5.qualifier to com.myurl.feature.bar.feature.group [1.1.4,1.1.5).; No solution found because the problem is unsatisfiable.]
    at org.eclipse.tycho.p2.resolver.AbstractResolutionStrategy.newResolutionException(AbstractResolutionStrategy.java:98)
    at org.eclipse.tycho.p2.resolver.ProjectorResolutionStrategy.resolve(ProjectorResolutionStrategy.java:88)
    at org.eclipse.tycho.p2.resolver.AbstractResolutionStrategy.resolve(AbstractResolutionStrategy.java:63)
    at org.eclipse.tycho.p2.impl.resolver.P2ResolverImpl.resolveDependencies(P2ResolverImpl.java:134)
    at org.eclipse.tycho.p2.impl.resolver.P2ResolverImpl.resolveDependencies(P2ResolverImpl.java:87)
    at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.doResolvePlatform(P2TargetPlatformResolver.java:369)
    at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.resolveDependencies(P2TargetPlatformResolver.java:345)
    at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.resolveProject(DefaultTychoDependencyResolver.java:109)
    at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:75)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:271)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    ... 11 more

Can anyone help me figure out why Tycho is not finding this dependency, even though it seems that the dependency is readily available and found successfully early on during the build?

Was it helpful?

Solution

I found the issue. The fact that I had a feature containing features that were available on a p2 repository was not the cause of my problem. You can definitely do that using Tycho.

My issue was with one of the features that was on the p2 repository. The guilty feature was com.myurl.feature.bar.

I had done something wrong with the way I built or deployed the p2 repository. I'm not sure what it was, but when I tore it down, rebuilt it, and re-deployed it, everything started working fine.

Some of the items that changed in the com.myurl.feature.bar feature were a removal of OS specific entries that are apparently legal on a site.xml, but not a category.xml file. I only say this because the editors that Eclipse provides for both have that main difference in them.

The strangest part is that my RCP application could see and use this p2 repository successfully for installing the com.myurl.feature.bar, but tycho couldn't use it to resolve the dependencies at build time... at least not until I changed up the p2 repository for it.

Special note for dgolovin... As far as I can tell, you definitely can refer to features on a p2 repository and include them in your feature even if they are not a direct part of your build.

OTHER TIPS

You should try to remove the .qualifier.

regards,

Change feature.xml to:

<feature>

   ...

<requires>
  <import feature="com.myurl.feature.foo" version="1.0.12" match="compatible"/>
  <import feature="com.myurl.feature.bar" version="1.1.4" match="compatible"/>
</requires>

p2 should pick up the latest available features form your p2 repositories.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top