Tycho: Bundle X - Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.7

I changed BREE from JavaSE-1.6

to JavaSE-1.7

in my app's manifest files:

Bundle-RequiredExecutionEnvironment: JavaSE-1.7

      

Now I cannot compile the application again.

When I run mvn clean install

I get:

[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

      

My toolchains.xml

contains:

  <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>

      

When I run the mvn -version

Java version looks 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"

      

I think my JAVA_HOME is correct, but I'm not sure. echo %JAVA_HOME%

prints C:\Java\jdk1.7.0_17\jre

. A related issue in the Tycho-Mailing list was resolved by setting JAVA_HOME correctly, but my problem seems to be different.

I am using Tycho at version 0.19.0. I also tried a newer version, but that didn't change anything.

+3


source to share


2 answers


Take a good look at the log message - it is unlikely that you will receive an error message

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

      

while Tycho resolves dependencies and the compilation classpath of another package project Y that depends on bundle X. Look for the message until the last message before the error:

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

      

This line shows which project has a permission issue.




If the failed design is in fact another bundle Y that depends on bundle X, you should check the Bundle-RequiredExecutionEnvironment

Y package header : if bundle Y declares, eg. BREE JavaSE-1.6, build is expected to fail. The reason for this is this: unless otherwise noted, Tycho assumes that you want to run package Y in an OSGi container that provides the runtime specified in the BREE header. In the example, this will be an OSGi container on a JavaSE-1.6 virtual machine. However, in such a container, Y cannot be started because it depends on X, which cannot be started. This is what Tycho detects and why the build fails.

You can deal with this situation in different ways:

  • Also change the BREE header of package Y. This makes sense in particular if you know that Y will always work with a version of package X that requires JavaSE-1.7.

  • Set up the runtime for package Y separately from the BREE header, eg. via target platform configuration executionEnvironment

    (not recommended). This can also change the JRE for which package Y is compiled, so package Y does not actually run in Java 6 anymore. Therefore, use this option only if you fully understand the implications of the runtime in the assembly .

  • Disable Tycho checks runtime constraints by setting the target platform configuration parameter resolveWithExecutionEnvironmentConstraints

    to false

    (since Tycho 0.22.0). This might make sense if your Y package can run with a completely different version or implementation of X than the version you are using at compile time.




If the failed project is the X package project itself, there is some configuration in the (parent) POM or build.properties, which makes Tycho use a different, lower execution implementation than the one listed in the Bundle-RequiredExecutionEnvironment

X package header (see the runtime configuration documentation ). You should probably remove this conflicting, redundant configuration.

+5


source


Is it possible that you configured a different runtime in the pom.xml (possibly inherited from the parent pom)? Cm



https://wiki.eclipse.org/Tycho/Execution_Environments#Execution_environment_configuration

+1


source







All Articles