I have a tycho-surefire test that fails because one of the dependencies it -org.eclipse.jdt.launching.macosx - has a platform filter - (osgi.os=macosx).
As far as I can see, the test fails as the Eclipse Installation used by tycho-surefire is resolved using all the defined environments in the target-platform-configuration.environments
- just like the "normal" compile environment - and not just the environment of the running platform, which I would have expected. If I temporarily removes
the defined environments from the target-platform-configuration, then everything works.
Looking at the sources, I can see TestMojo (indirectly) uses P2TargetPlatformResolver.doResolvePlatform which unconditionally sets the current environment as set in target-platform-configuration
before resolving the project with P2Resolved.
This patch introduces an addition to DependencyResolverConfiguration: getEnvironments(). This method is then overriden in TestMojo to just return the current executing environment.