Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 347177

Summary: Allow resolving older version of bundle also built in the reactor
Product: z_Archived Reporter: Alexander Fischer <afischer>
Component: TychoAssignee: Project Inbox <tycho-inbox>
Status: REOPENED --- QA Contact:
Severity: normal    
Priority: P3 CC: igor, sewe, t-oberlies
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Alexander Fischer CLA 2011-05-25 11:26:52 EDT
I have following situation:
Bundle A references Bundle B (Version 1.0.0) with Version-Range [1.0.0,1.1.0)
For Bundle B exists also a Version 1.2.0, which is referenced by other bundles.
Bundle B (Version 1.0.0) is located in a p2-repository and is found, if I build only Bundle A.
In the problematic Maven-run Bundle A *and* a newer version of Bundle B is build in the same profile. Then the build of Bundle A fails with missing requirement Bundle B (Version 1.0.0). So it seems, like the newer version of bundle B in the maven-run *hides* the older version from the p2-repository.
Is this a feature or a bug? I think, OSGi can manage different versions of bundles in the same environment.
Comment 1 Igor Fedorenko CLA 2011-05-25 11:35:52 EDT
Tycho can resolve mutually exclusive dependencies from repositories but does not allow external dependencies to conflict with reactor projects. This is necessary to make sure that external dependencies do not "shadow" reactor projects, see Bug 342637 for example.
Comment 2 Alexander Fischer CLA 2011-05-25 12:12:13 EDT
(In reply to comment #1)
> Tycho can resolve mutually exclusive dependencies from repositories but does
> not allow external dependencies to conflict with reactor projects. This is
> necessary to make sure that external dependencies do not "shadow" reactor
> projects, see Bug 342637 for example.

You have fixed a bug in 0.11.0 and the solution reduces the functionality of the p2-dependency-resolving.
I can not ensure, that reactor-projects (indirectly) references old versions of bundles, from which I want to build a newer version (e.g. the newer bundle-versions are reactor projects).

An example (one maven-run)

Reactor-Bundle A V2.0.0 --> Bundle B V1.5.0 --> Bundle C V1.5.0
Reactor-Bundle C V2.0.0
--> Build fails on dependency-resolving for Bundle A!

So I can not build different Bundles in one maven-run (on amount of reactor-projects)?

The build of features with a concrete bundle-version should IMHO solved at an other way.
Comment 3 Igor Fedorenko CLA 2011-05-25 12:14:42 EDT
This is correct and expected reactor build behaviour. If you need to depend on mutually exclusive versions of bundle C, build it separately.
Comment 4 Alexander Fischer CLA 2011-05-26 03:52:52 EDT
(In reply to comment #3)
> This is correct and expected reactor build behaviour. If you need to depend on
> mutually exclusive versions of bundle C, build it separately.

But I don't want to build version 1.5.0 and version 2.0.0 from bundle C in one run! I only want to resolve a dependency to the old version of bundle C (located in P2-Repository) in the same run like building the new version of bundle C.
Is this really not allowed?

So I must separate my builds over a multi-module pom in different maven-runs (with different profiles or so)?
Comment 5 Igor Fedorenko CLA 2011-05-26 09:13:08 EDT
This is correct. If bundle C is part of reactor build, tycho will ignore all other versions of this bundle. This is the only way to guarantee that inter-project dependencies are resolved from the reactor.
Comment 6 Tobias Oberlies CLA 2011-06-11 05:27:37 EDT
I agree that it is amost certainly a configuration error if an newer version of a bundle is preferred over a bundle from the reactor (see bug 342637). As long as Tycho doesn't have any proper support for dependency management, removing the newer versions from the reactor automagically is the only way to deal with this situation.

However all this reasoning doesn't apply for older versions of bundles. Tycho should certainly issue a warning in this case if there are older versions of locally built bundles in the target platform, but it shouldn't prevent that they are there. Therefore I agree with Alexander the situation described in comment 4 should work.
Comment 7 Tobias Oberlies CLA 2011-06-11 05:38:32 EDT
Changed the title from "Resolving different versions of a bundle in one maven-run" to "Allow resolving older version of bundle also built in the reactor". Just resolving two versions of an external bundle works.

In case this issue is fixed, we would also need to solve TYCHO-606 again [1], e.g. by replacing ".qualifier" by the max value string during dependency resolution.

[1] https://issues.sonatype.org/browse/TYCHO-606?focusedCommentId=129683&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_129683
Comment 8 Mickael Istria CLA 2021-04-08 18:12:59 EDT
Eclipse Tycho is moving away from this bugs.eclipse.org issue tracker to https://github.com/eclipse/tycho/issues/ instead. If this issue is relevant to you, your action is required.
0. Verify this issue is still happening with latest Tycho 2.4.0-SNAPSHOT
  if issue has disappeared, please change status of this issue to "CLOSED WORKFORME" with some details about your testing environment and how you did verify the issue; and you're done
  if issue is still present when latest release:
* Create a new issue at https://github.com/eclipse/tycho/issues/
  ** Use as title in GitHub the title of this Bugzilla ticket (may include the bug number or not, at your own convenience)
  ** In the GitHub description, start with a link to this bugzilla ticket
  ** Optionally add new content to the description if it can helps towards resolution
  ** Submit GitHub issue
* Update bugzilla ticket
  ** Add to "See also" property (up right column) the link to the newly created GitHub issue
  ** Add a comment "Migrated to <link-to-newly-created-GitHub-issue>"
  ** Set status as CLOSED MOVED
  ** Submit

All issues that remain open will be automatically closed next week or so. Then the Bugzilla component for Tycho will be archived and made read-only.