-1

I have a huge eclipse-rcp project "A" with many RCP-plugins. All these are being manifest-first built by tycho. In a separate project "B" I have some OSGi bundles.

I need to add bundles from B as dependencies to some plugins in A. When I add B bundles in A-plugin's MANIFEST.MF ("Require-Bundle: B.bundle1"), tycho does not find B.bundle1 ("Unable to satisfy dependency from A.plugin 1.0.0 to bundle B.bundle1 0.0.0").

I know, that I can configure tycho to use pom dependencies (consider and add B.bundle1 as maven dependency). Tycho can build project A now, but it ignores all manifests in A plugins and generates new ones. It looks like project A is now considered being pom-first.

How can I add OSGi bundles to my plugins, keeping plugins's build manifest-first?

Oroboros102
  • 2,214
  • 1
  • 27
  • 41

2 Answers2

1

Tycho is never POM-first, i.e. it never generates a Bundle manifests. It does however read and write the Manifest source file during the build (in order to replace the .qualifier literal), so the manifest in the build result may be formatted differently to the original. It is however equivalent to the source.

Note that the by definition of the manifest file format, the last line of a manifest is ignored if it is not terminated by a newline character. So if this is the case in your sources, it may seem that Tycho removes a header from the manifest. This is kind of true, but only because the header was invalid and would be ignored by an OSGi runtime anyway.

AFAIK, the most recent Tycho version prints a warning if the last line of the source manifest isn't properly terminated.

oberlies
  • 11,503
  • 4
  • 63
  • 110
  • Likely it's that results were formated and put in different order made me think like that. I overcomplicated things and tried to solve the problem I actually didn't have. Thanks for clearance about tycho and pom-first built. – Oroboros102 Sep 23 '13 at 16:03
0

Tycho can find bundles in two places: a P2 or a Maven repository.

If your B bundles are in a maven repository, even if you add a Require-Bundle into manifest you will need to add a dependency into A's pom. This means that it is not completely manifest-first.

But it is, only when your dependencies (project B) are in some P2 repository. then you just need to set the manifest (Import-Package is better then Require-Bundle).

So, one alternative is you do create a job in your CI to build and install bundles from project B into a maven repository (mvn install). Or do create a job that generate a p2 repository and deploy it to some HTTP server.

then create a job to build A where you will need to proper set its tycho build to use the generated maven repository... ( http://wiki.eclipse.org/Tycho/Target_Platform#.22POM_dependencies_consider.22) or the p2...

Cristiano
  • 1,414
  • 15
  • 22
  • Thanks for answer. But, in my build it is not enough to add B-bundles to MANIFEST and pom.xml as dependencies. It's not working _("Unable to satisfy dependency...")_, until I set `consider`. Which, in turn, switches the whole A build to pom-first, skipping all my complex manifests. – Oroboros102 Sep 20 '13 at 07:21
  • I'm curious. what kind of complex manifests are being skipped? – Cristiano Sep 21 '13 at 15:28
  • All the manifests in plugins in project A are not added to target plugins. New manifests are generated instead. – Oroboros102 Sep 21 '13 at 15:44
  • 1
    Man, there are something wrong with your build setup. Tycho doesn't generate any manifest. I'm using Tycho since 0.11 and never saw such thing. – Cristiano Sep 21 '13 at 23:22
  • maybe you have added maven-bundle-plugin in instead of – Cristiano Sep 21 '13 at 23:23
  • I have only 4 plugins in whole A project: tycho-maven-plugin (with extensions set to "true"), tycho-p2-repository-plugin, target-platform-configuration and tycho-compiler-plugin. No maven-bundle-plugin at all. And, well, AFAIK tycho is generating manifests, when it uses pom-first build. – Oroboros102 Sep 22 '13 at 06:44
  • if you want you could try to create some projects reproducing your problem and put it into a github repository that I take a look on it – Cristiano Sep 22 '13 at 13:11