在Eclipse的片段项目上运行mvn install
时,我得到了这个错误:
${fragment name}不能在这个环境中安装,因为它的过滤器不适用。
在Manifest中使用Eclipse-PlatformFilter: (osgi.os=macosx)
会破坏构建。
下面是键错误的输出(id/目录名被编辑):
[INFO] Resolving dependencies of MavenProject: ${fragmentID}:4.3.0-SNAPSHOT @ ${fragmentDir}/pom.xml
[INFO] {osgi.os=linux, org.eclipse.update.install.features=true, osgi.arch=x86_64, osgi.ws=gtk}
[ERROR] Cannot resolve project dependencies:
[ERROR] Problems resolving provisioning plan.:
[ERROR] ${fragment name} cannot be installed in this environment because its filter is not applicable.
[ERROR]
[ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
链接(http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting)没有帮助。
我在互联网上发现了一些类似的错误(component X cannot be installed in this environment because its filter is not applicable
),但它们都适用于下载软件的实例,并且没有解决方案或解决方案不适用于我的情况。
感谢任何帮助!
编辑:我发现在主机插件中使用Eclipse-PlatformFilter: (osgi.os=macosx)
工作,并且在片段中使用Eclipse-PlatformFilter: (| (osgi.os=macosx) (osgi.os=linux) (osgi.os=win32) )
工作。似乎构建要遍历祖先pom中设置的每个环境,当片段不应用于这些环境中的任何一个....时,构建就中断了当然我可以设置一些标志来防止这种情况发生?
为通过POM配置的所有操作系统环境构建Tycho。目前还没有办法将这些环境自动筛选为配置为Eclipse-PlatformFilter
的环境。因此,当仅为某个操作系统构建片段时,您需要在片段的POM中手动覆盖来自父POM的<environments>
配置:
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<environments>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>