Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Resolution of imported packages with fragments

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



Back to the top