在Eclipse中的片段项目上运行mvn install
时,出现以下错误:
$ {fragment name}无法安装在此环境中,因为它的过滤器不适用。
在清单中使用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中设置的每个环境,并且当该片段不适用于这些环境中的任何一个时,它都会中断。...肯定有一些我可以设置的标志来防止这种情况发生? 最佳答案
Tycho为通过POM配置的所有操作系统环境构建。当前无法自动将这些环境过滤为配置为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>