Tycho cannot resolve fragment dependency on another fragment

I want to create an extension for org.eclipse.swt as a fragment. I created the swt.extension package with the following MANIFEST.MF:

 Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Extension Bundle-SymbolicName: swt.extension Bundle-Version: 1.0.0.qualifier Fragment-Host: org.eclipse.swt;bundle-version="3.102.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.7 

In addition, I created an interface that extends the interface from SWT:

 public interface IExtendedStyleTextContent extends org.eclipse.swt.custom.StyledTextContent { } 

When I build my project with tycho ( mvn clean install ), the following error occurs:

 1. ERROR in C:\<path>\tycho-fragment-to-fragment-dependency\swt.extension\src\org\example\tycho_example\IExtendedStyleTextContent.java (at line 3) public interface IExtendedStyleTextContent extends org.eclipse.swt.custom.StyledTextContent { ^^^^^^^^^^^ org.eclipse cannot be resolved to a type 

Tycho seems to only allow the org.eclipse.swt bank. This is a host node and does not contain classes. Actual implementation in the org.eclipse.swt.win32.win32.x86_64 fragment package. And it looks like this package is not related to classpath when tycho-compiler-plugin compiles the project.

Is this a Tycho bug? Are their workarounds possible?

I put all the sources in GitHub: https://github.com/orionll/tycho-fragment-to-fragment-dependency

I am using maven 3.1.0

+4
source share
2 answers

So, a workaround for this problem was found on the mailing lists: http://dev.eclipse.org/mhonarc/lists/tycho-user/msg03277.html

To solve the problem, you need to add the following sections to the POM and build.properties:

 <build> <plugins> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>target-platform-configuration</artifactId> <version>${tycho-version}</version> <configuration> <dependency-resolution> <extraRequirements> <requirement> <type>eclipse-plugin</type> <id>org.eclipse.swt.win32.win32.x86_64</id> <versionRange>[3.0.0,4.0.0)</versionRange> </requirement> </extraRequirements> </dependency-resolution> </configuration> </plugin> </plugins> </build> 

build.properties:

 extra.. = platform:/fragment/org.eclipse.swt.win32.win32.x86_64 

I also updated the GitHub repository

+5
source

These are not many errors, but the main problem with the design of PDE / Tycho: build dependencies are supported as close as possible to run-time dependencies. In this case, you need to add an assembly dependency that does not have a corresponding dependency at run time, so it cannot be declared through the OSGi manifest.

The following mailing list message appears: http://dev.eclipse.org/mhonarc/lists/tycho-user/msg03277.html

+4
source

Source: https://habr.com/ru/post/1496391/


All Articles