【问题标题】:Headless PDE Build and Java Compiler Compliance无头 PDE 构建和 Java 编译器合规性
【发布时间】:2011-07-11 14:57:36
【问题描述】:

我的问题是我希望更新基于功能的 build.properties 文件,以便无头构建过程将使用 Java JRE/JDK 1.6 版本,但将与 Java JRE/JDK 1.5 版本兼容。

如何通过 build.properties 文件在无头构建中实现这一点(即,将设置哪些属性以及设置哪些值)?

我正在考虑 JavaSE-1.6、javaSource 和 javaTarget 属性的一些设置值组合,如下所示。

任何帮助将不胜感激。

############# JAVA COMPILER OPTIONS ##############
# The location of the Java jars to compile against.  Typically the rt.jar
#  for your JDK/JRE
#bootclasspath=${java.home}/lib/rt.jar

# specific JRE locations to compile against. These values are used to compile
#  bundles specifying a Bundle-RequiredExecutionEnvironment. Uncomment and set
#  values for environments that you support
#CDC-1.0/Foundation-1.0= /path/to/rt.jar
#CDC-1.1/Foundation-1.1=
#OSGi/Minimum-1.0=
#OSGi/Minimum-1.1=
#JRE-1.1=
#J2SE-1.2=
#J2SE-1.3=
#J2SE-1.4=
#J2SE-1.5=
JavaSE-1.6=${java.home}/lib/rt.jar
#PersonalJava-1.1=
#PersonalJava-1.2=
#CDC-1.0/PersonalBasis-1.0=
#CDC-1.0/PersonalJava-1.0i=
#CDC-1.1/PersonalBeclipseasis-1.1=
#CDC-1.1/PersonalJava-1.1=

...

# Default value for the version of the source code. This value is used when
#  compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment
#  or set javacSource in build.properties
javacSource=1.5

# Default value for the version of the byte code targeted. This value is used
#  when compiling plug-ins that do not set the
#  Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties.
javacTarget=1.5

【问题讨论】:

    标签: eclipse eclipse-plugin eclipse-pde


    【解决方案1】:

    您为什么不在您的 PDE 构建中执行此操作,为什么不在您的插件中将 Bundle-RequiredExecutionEnvironment 设置为 Java 5? PDE 中的清单编辑器将帮助您将其设置为正确的值。

    【讨论】:

    • 感谢康斯坦丁的跟进!捆绑包当前在 MANIFEST.MF 文件中设置了此属性,因此该属性已设置。我假设通过为 javacSource 和 javacTarget 提供默认值 1.5 将涵盖任何可能更改或未提供此属性的包(例如,未来的包)。至于设置 JavaSE-1.6 属性,这是否告诉 PDE 使用 Java JDK/JRE 1.6 发行版?我的终极目标是在同一台机器上存在多个 JRE/JDK 版本时使用 1.6。这是否仅由 JAVA_HOME 变量控制?
    • PDE 构建根据插件元数据确定需要构建给定插件的理想 Java 版本。然后它会查看您的 build.properties 以找到匹配的 JDK。如果没有找到匹配的版本,它会搜索后备版本。理想情况下,您应该使用插件的最低兼容级别进行构建。这不仅会适当地设置语言级别,还会发现意外使用新版本 Java 中引入的类。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-14
    • 1970-01-01
    • 2015-06-17
    • 1970-01-01
    相关资源
    最近更新 更多