Java &引用;API限制错误“;使用maven tycho导出Eclipse插件时:
我目前正在尝试使用Maven(Tycho扩展)构建和导出一个Eclipe插件,但它会抛出一系列API限制错误Java &引用;API限制错误“;使用maven tycho导出Eclipse插件时:,java,eclipse,maven,plugins,tycho,Java,Eclipse,Maven,Plugins,Tycho,我目前正在尝试使用Maven(Tycho扩展)构建和导出一个Eclipe插件,但它会抛出一系列API限制错误 [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:09 min [INFO] Finished at: 2015-03-02T13:57:35+03:00 [INFO] Final Memory
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:09 min
[INFO] Finished at: 2015-03-02T13:57:35+03:00
[INFO] Final Memory: 78M/187M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.22.0:compile (default-compile) on project GDBFifoBlocks: Compilation failure: Compilation failure:
[ERROR] /home/siarshai/Programming/Workspaces/eclipse-rcp-workspace/GDBFifoBlocksBackbone/src/neuromatrixplugin/fifoblocks/backbone/viewmodel/fifo/FIFOBlockBitFieldVMNode.java:[240]
[ERROR] update.setLabel(getMessageFormat().format(
[ERROR] messageAttrs, new StringBuffer(), null).toString(), columnIndex);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The method 'MessageFormat.format(Object[], StringBuffer, FieldPosition)' is not API (restriction on classpath entry '/home/siarshai/.m2/repository/p2/osgi/bundle/com.ibm.icu/52.1.1.v201501240615/com.ibm.icu-52.1.1.v201501240615.jar')
[ERROR] /home/siarshai/Programming/Workspaces/eclipse-rcp-workspace/GDBFifoBlocksBackbone/src/neuromatrixplugin/fifoblocks/backbone/viewmodel/fifo/FIFOBlockBitFieldVMNode.java:[345]
[ERROR] update.setLabel(getMessageFormat().format(combinedAttrs, new StringBuffer(), null).toString(), columnIndex);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The method 'MessageFormat.format(Object[], StringBuffer, FieldPosition)' is not API (restriction on classpath entry '/home/siarshai/.m2/repository/p2/osgi/bundle/com.ibm.icu/52.1.1.v201501240615/com.ibm.icu-52.1.1.v201501240615.jar')
[ERROR] /home/siarshai/Programming/Workspaces/eclipse-rcp-workspace/GDBFifoBlocksBackbone/src/neuromatrixplugin/fifoblocks/backbone/viewmodel/fifo/FIFOBlockBitFieldVMNode.java:[395]
[ERROR] update.setLabel(getMessageFormat().format(combinedAttrs, new StringBuffer(), null).toString(), columnIndex);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The method 'MessageFormat.format(Object[], StringBuffer, FieldPosition)' is not API (restriction on classpath entry '/home/siarshai/.m2/repository/p2/osgi/bundle/com.ibm.icu/52.1.1.v201501240615/com.ibm.icu-52.1.1.v201501240615.jar')
[ERROR] /home/siarshai/Programming/Workspaces/eclipse-rcp-workspace/GDBFifoBlocksBackbone/src/neuromatrixplugin/fifoblocks/backbone/viewmodel/fifo/FIFOBlockElementVMNode.java:[290]
[ERROR] update.setLabel(getMessageFormat().format(messageAttrs, new StringBuffer(), null).toString(), columnIndex);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The method 'MessageFormat.format(Object[], StringBuffer, FieldPosition)' is not API (restriction on classpath entry '/home/siarshai/.m2/repository/p2/osgi/bundle/com.ibm.icu/52.1.1.v201501240615/com.ibm.icu-52.1.1.v201501240615.jar')
[ERROR] /home/siarshai/Programming/Workspaces/eclipse-rcp-workspace/GDBFifoBlocksBackbone/src/neuromatrixplugin/fifoblocks/backbone/viewmodel/fifo/FIFOBlockElementVMNode.java:[366]
[ERROR] update.setLabel(getMessageFormat().format(combinedAttrs, new StringBuffer(), null).toString(), columnIndex);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Access restriction: The method 'MessageFormat.format(Object[], StringBuffer, FieldPosition)' is not API (restriction on classpath entry '/home/siarshai/.m2/repository/p2/osgi/bundle/com.ibm.icu/52.1.1.v201501240615/com.ibm.icu-52.1.1.v201501240615.jar')
My pom.xml文件:(有关更多详细信息,请参见问题)
父项目
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>NMGDBPluginFeature</groupId>
<artifactId>NMGDBPluginFeature.parent</artifactId>
<version>1.0.0.gdbfifoblocks</version>
<packaging>pom</packaging>
<properties>
<tycho-version>0.22.0</tycho-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>eclipse-luna</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/luna</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>0.22.0</version>
<extensions>true</extensions>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>../GDBFifoBlocksBackbone</module>
<module>../NMGDBPluginFeature</module>
</modules>
</project>
4.0.0
NMGDBPluginFeature
NMGDBPluginFeature.parent
1.0.0.gdbfifoblocks
聚甲醛
0.22.0
UTF-8
月蚀
p2
http://download.eclipse.org/releases/luna
org.eclipse.tycho
tycho maven插件
0.22.0
真的
-警告:没有
-呃:没有
../GDBFifoBlocksBackbone
../NMGDBPluginFeature
专题项目:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>NMGDBPluginFeature</groupId>
<artifactId>NMGDBPluginFeature.parent</artifactId>
<version>1.0.0.gdbfifoblocks</version>
<relativePath>./../GeneralExportingProject</relativePath>
</parent>
<artifactId>NMGDBPluginFeature</artifactId>
<packaging>eclipse-feature</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>0.22.0</version>
<extensions>true</extensions>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
</project>
4.0.0
NMGDBPluginFeature
NMGDBPluginFeature.parent
1.0.0.gdbfifoblocks
../../GeneralExportingProject
NMGDBPluginFeature
eclipse特性
org.eclipse.tycho
tycho maven插件
0.22.0
真的
-警告:没有
-呃:没有
插件项目:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>NMGDBPluginFeature</groupId>
<artifactId>NMGDBPluginFeature.parent</artifactId>
<version>1.0.0.gdbfifoblocks</version>
<relativePath>./../GeneralExportingProject</relativePath>
</parent>
<artifactId>GDBFifoBlocks</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>0.22.0</version>
<extensions>true</extensions>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
</project>
4.0.0
NMGDBPluginFeature
NMGDBPluginFeature.parent
1.0.0.gdbfifoblocks
../../GeneralExportingProject
GDBFifoBlocks
eclipse插件
org.eclipse.tycho
tycho maven插件
0.22.0
真的
-警告:没有
-呃:没有
我确信插件和导出功能配置(即MANIFEST和feature.xml)编写得很好。我已经试过了:
我在谷歌上没有找到其他推荐。我应该将此报告为bug还是我的错误?感谢@oberlies的评论,答案已经找到。compilerArgument应该传递给tycho编译器插件,而不是tycho maven插件,因此需要正确的配置
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>0.22.0</version>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>0.22.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
org.eclipse.tycho
第谷编译器插件
0.22.0
-警告:没有
-呃:没有
org.eclipse.tycho
tycho maven插件
0.22.0
真的
出于某些原因,Tycho不会在编辑器中或运行期间警告不匹配的标记。如果eclipse插件项目确实具有特定于项目的设置,则这些设置可能会覆盖编译器行为,因此即使将标志设置为警告,错误仍可能出现:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgument>-warn:+discouraged,forbidden</compilerArgument>
<useProjectSettings>false</useProjectSettings>
</configuration>
</plugin>
org.eclipse.tycho
第谷编译器插件
${tycho.version}
-警告:气馁,禁止
假的
您还可以从插件中删除特定于项目的设置文件夹,或调整此编译器标志的设置。您确实要使用“com.ibm.icu”中的
MessageFormat
?或者您试图使用正常的java.text.MessageFormat
?compilerArgument
不是tycho maven插件上的参数,因此此配置无效。@greg-449,当然,还有许多其他受限类。由于项目的性质,它们是不可避免的。@oberlies谢谢,情况就是这样。我的错误是:没有注意到我实际使用的插件。公平地说,我的插件构建配置命令使用已编译的文件,因此我认为tycho在验证时失败。tycho没有警告不匹配的标记-这同样适用于所有Maven配置:插件配置适用于Maven插件的所有目标,因此存在不适用的标记是正常的。Maven(或Tycho)可以尝试通过扫描所有潜在目标及其参数来找到永远不会应用的标记-但这只是还没有实现而已。。。