第谷:捆绑包X-缺少约束:捆绑包必需的执行环境:JavaSE-1.7 [英] Tycho: Bundle X - Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.7

查看:186
本文介绍了第谷:捆绑包X-缺少约束:捆绑包必需的执行环境:JavaSE-1.7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将应用程序清单文件中的BREE从JavaSE-1.6更改为JavaSE-1.7:

I have changed the BREE from JavaSE-1.6 to JavaSE-1.7 in the manifest files of my application:

Bundle-RequiredExecutionEnvironment: JavaSE-1.7

现在我无法再次编译该应用程序.

Now I can not compile the application again.

当我运行mvn clean install时,我得到:

[INFO] Resolving dependencies of MavenProject: Xgroup:X:4.0.100-SNAPSHOT @ C:\Users\....\X\pom.xml
[WARNING] The following locally built units have been used to resolve project dependencies:
[WARNING]   Za
[WARNING]   Zb
[INFO] Resolving class path of MavenProject: Xgroup:X:4.0.100-SNAPSHOT @ C:\Users\....\X\pom.xml
[ERROR] Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle X cannot be resolved
[ERROR] Resolution errors:
[ERROR] Bundle X - Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.7
[ERROR] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle X cannot be resolved
Resolution errors:
   Bundle X - Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.7

我的toolchains.xml包含:

  <toolchain>
     <type>jdk</type>
     <provides>
         <version>1.7</version>
         <vendor>sun</vendor>
         <id>JavaSE-1.7</id>
     </provides>
     <configuration>
        <jdkHome>C:\Java\jdk1.7.0_45</jdkHome>
     </configuration>
  </toolchain>

当我运行mvn -version时,Java版本似乎还可以:

When I run mvn -version the Java version seems to be OK:

Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: C:\Tools\apache-maven-3.0.4\bin\..
Java version: 1.7.0_17, vendor: Oracle Corporation
Java home: C:\Java\jdk1.7.0_17\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

我猜我的JAVA_HOME是正确的,但是我不确定. echo %JAVA_HOME%打印C:\Java\jdk1.7.0_17\jre.通过设置解决了相关的问题 JAVA_HOME正确,但是我的问题似乎有所不同.

I guess my JAVA_HOME is correct, but I am not sure. echo %JAVA_HOME% prints C:\Java\jdk1.7.0_17\jre. A related problem on the Tycho-Mailing list was solved by setting JAVA_HOME correctly, but my problem seems to be different.

我在0.19.0版中使用Tycho.我也尝试过更新的版本,但这并没有改变任何东西.

I'm using Tycho in version 0.19.0. I have also tried a newer version, but this didn't change anything.

推荐答案

仔细查看日志消息-不太可能收到错误消息

Have a close look into the log message - it is not unlikely that you get the error message

[ERROR] Bundle X - Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.7

Tycho解决依赖关系和依赖于捆绑软件X的另一个捆绑软件项目Y的编译类路径.在错误之前找到以下日志消息的最后一个:

while Tycho resolves dependencies and the compile class path of a different bundle project Y which depends on bundle X. Find the last one of the following log messages prior to the error:

[INFO] Resolving class path of MavenProject: ...

此行显示哪个项目存在解析问题.

This line shows which project has the resolution problem.

如果失败的项目实际上是依赖于捆绑软件X的另一个捆绑软件Y,则应检查捆绑软件Y的Bundle-RequiredExecutionEnvironment标头:如果捆绑软件Y声明例如如果是JavaSE-1.6的BREE,则预期构建会失败.原因如下:除非另行配置,否则Tycho假定您要在OSGi容器中运行捆绑软件Y,该容器提供BREE标头中指定的执行环境.在示例中,这将是JavaSE-1.6 VM上的OSGi容器.但是,在这样的容器中,Y无法启动,因为它取决于无法启动的X.这是Tycho所检测到的,也是构建失败的原因.

If the failing project is in fact a different bundle Y which depends on bundle X, you should check the Bundle-RequiredExecutionEnvironment header of bundle Y: If bundle Y declares e.g. a BREE of JavaSE-1.6, it is expected that the build fails. The reason for this is as follows: Unless configured otherwise, Tycho assumes that you want to run bundle Y in OSGi container that provides the execution environment specified in the BREE header. In the example this would be an OSGi container on a JavaSE-1.6 VM. However in such a container, Y could not be started because it depends on X which can not be started. This is what Tycho detects and why the build fails.

您可以通过不同的方式处理这种情况:

You can deal with this situation in different ways:

  • 还更改了捆绑软件Y的BREE标头.如果您知道Y将始终与捆绑软件X的版本(需要JavaSE-1.7)一起运行,则这尤其有意义.

  • Also change the BREE header of bundle Y. This in particular makes sense if you know that Y will will anyway always run together with the version of bundle X which requires JavaSE-1.7.

与BREE标头分开配置包Y的执行环境,例如通过executionEnvironment目标平台配置(不推荐).这也可能会更改要为捆绑软件Y编译的JRE,因此捆绑软件Y实际上可能不再在Java 6上运行.因此,只有在完全理解

Configure the execution environment for bundle Y separately from the BREE header, e.g. via the executionEnvironment target platform configuration (not recommended). This may also change the JRE that bundle Y is compiled for, so bundle Y may then in fact no longer run on Java 6. So only use this option if you fully understand the implications of the execution environment on the build.

通过将目标平台配置参数resolveWithExecutionEnvironmentConstraints设置为false(从Tycho 0.22.0开始)来禁用Tycho对执行环境约束的检查. 这可能是有道理的,如果您的捆绑软件Y可以使用与捆绑软件X完全不同的版本或实现来运行在编译时使用.

Disable Tycho's checks for execution environment constraints by setting the target platform configuration parameter resolveWithExecutionEnvironmentConstraints to false (since Tycho 0.22.0). This may make sense if your bundle Y may run with a completely different version or implementation of bundle X than the version you use at compile time.

如果失败的项目是bundle X项目本身,则(父)POM或build.properties中有一些配置,这使得Tycho使用了与Bundle-RequiredExecutionEnvironment标头中指定的环境不同的,更低的执行环境.捆绑软件X(有关详细信息,请参见有关执行环境配置的文档).您可能应该删除此有冲突的冗余配置.

If the failing project is the bundle X project itself, there is some configuration in the (parent) POM or the build.properties which makes Tycho use a different, lower execution envirionment than the one specified in the Bundle-RequiredExecutionEnvironment header of bundle X (see documentation on the execution environment configuration for details). You should probably remove this conflicting, redundant configuration.

这篇关于第谷:捆绑包X-缺少约束:捆绑包必需的执行环境:JavaSE-1.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆