Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual configuration IU in p2.inf does not work in 4.0.3 (works in 3.0.5) #2977

Closed
mdaloia opened this issue Oct 31, 2023 Discussed in #2972 · 5 comments
Closed

Virtual configuration IU in p2.inf does not work in 4.0.3 (works in 3.0.5) #2977

mdaloia opened this issue Oct 31, 2023 Discussed in #2972 · 5 comments

Comments

@mdaloia
Copy link
Contributor

mdaloia commented Oct 31, 2023

Discussed in #2972

Originally posted by mdaloia October 30, 2023
Hi,

We have a "virtual" IU provided and required in a p2.inf file of a bundle to add a touchpoint configuration (it really doesn't matter what it does) that used to work in 3.0.5. We are migrating to 4.0.3 and found that it fails with:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: p2.inf 1.0.0.qualifier
[ERROR]   Missing requirement: p2.inf 1.0.0.qualifier requires 'org.eclipse.equinox.p2.iu; configure.p2.inf 0.0.0' but it could not be found

I have reduced it to an example project: https://github.com/mdaloia/tycho-p2-inf

(Environment used: Maven 3.9.4 / Java 17)

If I build it with

  • mvn clean package -Dtycho.localArtifacts=ignore -Dtycho-version=4.0.3
    it fails with the mentioned error and no target/p2content.xml is created.

I tried adding -Dtycho.resolver.classic=false as explained in "mixed reactor setups require the new resolver now" but I got the same error.

But if I only change the version:

  • mvn clean package -Dtycho.localArtifacts=ignore -Dtycho-version=3.0.5
    it works and in the target/p2content.xml file I see the <unit id='configure.p2.inf'> and the <required namespace='org.eclipse.equinox.p2.iu' name='configure.p2.inf' range='0.0.0'/>

This is because I have <pomDependencies>consider</pomDependencies> and it shows this message:

[INFO] The following requirements are not satisfied yet and must be provided through pom dependencies:
[INFO]    - org.eclipse.equinox.p2.iu; configure.p2.inf 0.0.0

If I remove this configuration it fails with the same error as using 4.0.3.

mdaloia added a commit to mdaloia/tycho that referenced this issue Oct 31, 2023
Virtual configuration IU in p2.inf does not work in 4.0.3 (works in 3.0.5)
laeubi pushed a commit to laeubi/tycho that referenced this issue Nov 3, 2023
Virtual configuration IU in p2.inf does not work in 4.0.3 (works in 3.0.5)
laeubi added a commit to laeubi/tycho that referenced this issue Nov 3, 2023
Currently units from p2.inf are not published to the target-platform
what can fail resolving when these are referenced in the project.

This publishes these units into the target-platform state of the
project.

Fix eclipse-tycho#2977
laeubi added a commit to laeubi/tycho that referenced this issue Nov 3, 2023
Currently units from p2.inf are not published to the target-platform
what can fail resolving when these are referenced in the project.

This publishes these units into the target-platform state of the
project.

Fix eclipse-tycho#2977
laeubi pushed a commit that referenced this issue Nov 3, 2023
Virtual configuration IU in p2.inf does not work in 4.0.3 (works in 3.0.5)
@laeubi laeubi closed this as completed in 32f6249 Nov 3, 2023
laeubi pushed a commit to laeubi/tycho that referenced this issue Nov 3, 2023
Virtual configuration IU in p2.inf does not work in 4.0.3 (works in 3.0.5)
laeubi added a commit to laeubi/tycho that referenced this issue Nov 3, 2023
Currently units from p2.inf are not published to the target-platform
what can fail resolving when these are referenced in the project.

This publishes these units into the target-platform state of the
project.

Fix eclipse-tycho#2977
laeubi pushed a commit that referenced this issue Nov 4, 2023
Virtual configuration IU in p2.inf does not work in 4.0.3 (works in 3.0.5)
laeubi added a commit that referenced this issue Nov 4, 2023
Currently units from p2.inf are not published to the target-platform
what can fail resolving when these are referenced in the project.

This publishes these units into the target-platform state of the
project.

Fix #2977
mdaloia added a commit to mdaloia/tycho that referenced this issue Nov 10, 2023
These changes show that the fix for issue eclipse-tycho#2977 made in PR eclipse-tycho#2989 was
partial.

When there is another bundle/plugin that requires the bundle which
contains the p2.inf file that provides and requires the virtual IU the
original error is triggered again even with Tycho 4.0.4.
@mdaloia
Copy link
Contributor Author

mdaloia commented Nov 10, 2023

@laeubi Unfortunately the changes made in PR #2989 partially fixes it.

If you have another bundle in which the Require-Bundle references the bundle that has the p2.inf with the provides & requires the same error appears:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: pvu.bundle2 1.0.0.qualifier
[ERROR]   Missing requirement: pvu.bundle 1.0.0.qualifier requires 'org.eclipse.equinox.p2.iu; configure.pvu.bundle 0.0.0' but it could not be found
[ERROR]   Cannot satisfy dependency: pvu.bundle2 1.0.0.qualifier depends on: osgi.bundle; pvu.bundle 0.0.0

See these changes to the originally provided integration test: master...mdaloia:tycho:pr-2977-partial-fix

Try building it with: mvn clean package -Dtycho.localArtifacts=ignore -Dtycho-version=4.0.4

Let me know if do you want me to provide a PR with these modifications to the IT, create another IT, or any other thing.

Thanks in advance!

@laeubi
Copy link
Member

laeubi commented Nov 11, 2023

@mdaloia I just thought that such case might came up... :-\

I think the best would be to have an additional case, so one can investigate to solve this, but maybe in such a case you want to make the requirement optional and greedy instead? Then it won't be required at build time.

@mdaloia
Copy link
Contributor Author

mdaloia commented Nov 13, 2023

@laeubi Thanks for the hint about using a requirement optional and greedy... it worked.

Ok, I will provide another reproducer example.

BTW, Do you know if there is any other documentation than this one https://wiki.eclipse.org/Equinox/p2/Customizing_Metadata that explains what is/means all the available options?

@laeubi
Copy link
Member

laeubi commented Nov 13, 2023

BTW, Do you know if there is any other documentation than this one https://wiki.eclipse.org/Equinox/p2/Customizing_Metadata that explains what is/means all the available options?

I fear not p2.inf usage is very very special area so if you like to improve that it would be best to contribute it directly to p2 as even the wiki is about to shutdown soon :-\

Also Tycho has some docs that might deserve some docs about p2.inf usage: https://github.com/eclipse-tycho/tycho/tree/master/src/site

mdaloia added a commit to mdaloia/tycho that referenced this issue Nov 14, 2023
The fix of PR eclipse-tycho#2978 was a partial fix for issue eclipse-tycho#2977. It fixed the case
of a single bundled but when the bundle providing/requiring the virtual
IU is required by another bundle it fails with the same error as before
even with Tycho 4.0.4:

```
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: pvumb.bundle2 1.0.0.qualifier
[ERROR]   Missing requirement: pvumb.bundle1 1.0.0.qualifier requires 'org.eclipse.equinox.p2.iu; configure.pvumb.bundle1 0.0.0' but it could not be found
[ERROR]   Cannot satisfy dependency: pvumb.bundle2 1.0.0.qualifier depends on: osgi.bundle; pvumb.bundle1 0.0.0
```

A workaround is to use:

```
requires.0.optional=true
requires.0.greedy=true
```
@mdaloia
Copy link
Contributor Author

mdaloia commented Nov 14, 2023

@laeubi I've just opened #3039 with the new IT case.

Hope this helps. Let me know otherwise. Thanks!

laeubi pushed a commit to laeubi/tycho that referenced this issue Dec 5, 2023
The fix of PR eclipse-tycho#2978 was a partial fix for issue eclipse-tycho#2977. It fixed the case
of a single bundled but when the bundle providing/requiring the virtual
IU is required by another bundle it fails with the same error as before
even with Tycho 4.0.4:

```
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: pvumb.bundle2 1.0.0.qualifier
[ERROR]   Missing requirement: pvumb.bundle1 1.0.0.qualifier requires 'org.eclipse.equinox.p2.iu; configure.pvumb.bundle1 0.0.0' but it could not be found
[ERROR]   Cannot satisfy dependency: pvumb.bundle2 1.0.0.qualifier depends on: osgi.bundle; pvumb.bundle1 0.0.0
```

A workaround is to use:

```
requires.0.optional=true
requires.0.greedy=true
```
laeubi pushed a commit that referenced this issue Dec 6, 2023
The fix of PR #2978 was a partial fix for issue #2977. It fixed the case
of a single bundled but when the bundle providing/requiring the virtual
IU is required by another bundle it fails with the same error as before
even with Tycho 4.0.4:

```
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: pvumb.bundle2 1.0.0.qualifier
[ERROR]   Missing requirement: pvumb.bundle1 1.0.0.qualifier requires 'org.eclipse.equinox.p2.iu; configure.pvumb.bundle1 0.0.0' but it could not be found
[ERROR]   Cannot satisfy dependency: pvumb.bundle2 1.0.0.qualifier depends on: osgi.bundle; pvumb.bundle1 0.0.0
```

A workaround is to use:

```
requires.0.optional=true
requires.0.greedy=true
```
laeubi pushed a commit to laeubi/tycho that referenced this issue Dec 6, 2023
The fix of PR eclipse-tycho#2978 was a partial fix for issue eclipse-tycho#2977. It fixed the case
of a single bundled but when the bundle providing/requiring the virtual
IU is required by another bundle it fails with the same error as before
even with Tycho 4.0.4:

```
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: pvumb.bundle2 1.0.0.qualifier
[ERROR]   Missing requirement: pvumb.bundle1 1.0.0.qualifier requires
'org.eclipse.equinox.p2.iu; configure.pvumb.bundle1 0.0.0' but it could
not be found
[ERROR]   Cannot satisfy dependency: pvumb.bundle2 1.0.0.qualifier
depends on: osgi.bundle; pvumb.bundle1 0.0.0
```

A workaround is to use:

```
requires.0.optional=true
requires.0.greedy=true
```
laeubi pushed a commit that referenced this issue Dec 6, 2023
The fix of PR #2978 was a partial fix for issue #2977. It fixed the case
of a single bundled but when the bundle providing/requiring the virtual
IU is required by another bundle it fails with the same error as before
even with Tycho 4.0.4:

```
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: pvumb.bundle2 1.0.0.qualifier
[ERROR]   Missing requirement: pvumb.bundle1 1.0.0.qualifier requires
'org.eclipse.equinox.p2.iu; configure.pvumb.bundle1 0.0.0' but it could
not be found
[ERROR]   Cannot satisfy dependency: pvumb.bundle2 1.0.0.qualifier
depends on: osgi.bundle; pvumb.bundle1 0.0.0
```

A workaround is to use:

```
requires.0.optional=true
requires.0.greedy=true
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants