Resolution of imported packages with fragments #237
Unanswered
soerendomroes
asked this question in
Q&A
Replies: 1 comment 1 reply
-
If you already filtering, I think you also need to filter out any fragments here. The way SWT works with its fragments is rather special so I fear there is no "clean" way to archive this. Your resolution errors on the other hand seems to be caused by missing use clauses on the package imports, so corresponding packages are not resolved to one provider. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
we have a large plugin that uses SWT. However, we also need this plugin in a non-UI context, in which we would like to leave out the native SWT dependencies. We do not want to split the plugin (which probably would be the cleanest way) and we cannot simply omit the SWT dependencies because the code actively uses SWT classes even in the non-UI context.
Hence, we decided to create a hollow SWT plugin that contains the required classes with a minimal implementation and can take the place of the real SWT plugin.
In the manifest we moved SWT from required plugins to imported packages and configured Maven Tycho to toggle between real SWT and our hollow one (by filtering the dependencies).
Our problem is that SWT uses native fragments and eclipse resolves the imported packages against all these fragments randomly. For example, on Linux we get errors that package *.swt.whatever supplied by *.swt.osx.jar does not match the current platform, while other packages are supplied by the correct platform fragment.
When using optional package dependencies instead, this seems to work but feels wrong because we actually need this dependency.
Is this a bug in the plugin resolution or do imported package dependencies simply not work with fragments?
Is there a better way in Maven/Tycho/Eclipse to support switching between different plugins that provide the same SWT packages?
Thanks in advance,
Sören
Beta Was this translation helpful? Give feedback.
All reactions