Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Tycho无法解析对其他片段的片段依赖关系_Java_Maven_Osgi_Tycho_Osgi Fragment - Fatal编程技术网

Java Tycho无法解析对其他片段的片段依赖关系

Java Tycho无法解析对其他片段的片段依赖关系,java,maven,osgi,tycho,osgi-fragment,Java,Maven,Osgi,Tycho,Osgi Fragment,我想为org.eclipse.swt创建一个片段扩展。我已经用以下MANIFEST.MF创建了一个bundleswt.extension: 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-vers

我想为
org.eclipse.swt
创建一个片段扩展。我已经用以下MANIFEST.MF创建了一个bundle
swt.extension

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
此外,我还创建了一个接口,它从SWT扩展了一个接口:

public interface IExtendedStyleTextContent extends org.eclipse.swt.custom.StyledTextContent {
}
当我使用tycho(
mvn clean install
)构建项目时,出现以下错误:

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
1。C:\\tycho fragment to fragment dependency\swt.extension\src\org\example\tycho\u example\IExtendedStyleTextContent.java中出错(第3行)
公共接口IExtendedStyleTextContent扩展org.eclipse.swt.custom.StyledTextContent{
^^^^^^^^^^^
org.eclipse无法解析为类型
tycho似乎只解析org.eclipse.swt jar。这是一个主机包,不包含任何类。实际实现在org.eclipse.swt.win32.win32.x86_64片段包中。当tycho编译器插件编译项目时,这个包似乎不在类路径上

这是第谷的虫子吗?他们有解决办法吗

我已将所有来源放在GitHub上:


我使用maven 3.1.0这并不是一个bug,而是PDE/Tycho设计的一个基本问题:构建依赖项尽可能接近运行时依赖项。在这种情况下,您需要添加一个在运行时没有相应依赖项的构建依赖项,因此无法通过OSGi mani声明节日


下面的邮件列表消息似乎正好提供了解决此问题的方法:

因此,在邮件列表中找到了解决此问题的方法:

要解决此问题,应在POM和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>
extra.. = platform:/fragment/org.eclipse.swt.win32.win32.x86_64

我还更新了GitHub存储库

谢谢你的链接。我将为我的问题发布一个单独的答案。顺便说一句,你需要的
额外要求
是SWT中的一个缺陷:请注意将依赖项解析放在片段的pom.xml中,并将额外的..放在使用e片段。@oberlies那么,这个错误修复了吗?我应该如何更新我的POM以避免
额外要求
?非常感谢!添加
额外..
build.properties为我解决了这个问题。我为此花了很多时间,谢谢!