Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature project not compiled when using toolchains.xml #4442

Open
Phillipus opened this issue Nov 19, 2024 · 4 comments
Open

Feature project not compiled when using toolchains.xml #4442

Phillipus opened this issue Nov 19, 2024 · 4 comments

Comments

@Phillipus
Copy link

If the host system Java version differs from that specified in a plugin's BREE and that plug-in is referenced in an Eclipse Feature project, compilation of the Feature fails even if toolchains.xml contains the path to the correct Java version.

Attached is a test.zip file containing a very simple pom.xml file, an Eclipse Plug-in Project, an Eclipse Feature Project and a toolchains.xml file (and a .mvn folder containing a extensions.xml file).

To test this:

  1. Ensure the host system Java is version 17. (Or run export JAVA_HOME=/pathto/Java17 before running mvn clean verify)
  2. Edit the attached toolchains.xml file so that the jdkHome paths point to Java 17 and 21 locations (you might not need the JavaSE-17 one)
  3. Copy the toolchains.xml file to the ~/.m2 directory or use the --global-toolchains file option to reference it
  4. Run mvn clean verify
  5. The following error occurs:
[INFO] Resolving dependencies of MavenProject: test:TestFeature:1.0.0-SNAPSHOT @ test/TestFeature/.polyglot.feature.xml
[ERROR] TestProject 1.0.0.202411190919 requires Execution Environment that matches (&(osgi.ee=JavaSE)(version=21)) but the current resolution context uses [a.jre.javase 17.0.0]
[INFO] {osgi.os=win32, osgi.ws=win32, org.eclipse.update.install.features=true, osgi.arch=x86_64, org.eclipse.update.install.sources=true}
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: TestFeature.feature.group 1.0.0.qualifier
[ERROR]   Missing requirement: TestProject 1.0.0.202411190919 requires 'osgi.ee; (&(osgi.ee=JavaSE)(version=21))' but it could not be found
[ERROR]   Cannot satisfy dependency: TestFeature.feature.group 1.0.0.qualifier depends on: org.eclipse.equinox.p2.iu; TestProject 0.0.0

Note that compilation succeeds if <module>TestFeature</module> is removed from the pom.xml file. So the error seems to occur only with Feature Projects.

@laeubi
Copy link
Member

laeubi commented Nov 19, 2024

<useJDK>BREE</useJDK> and <maven.compiler.target>21</maven.compiler.target> do not really make sense, any reason for this combination?

Beside that features are not compiled (just resolved / packaged) and the errors says that your feature depends on something that requires Java 21 but you are using Java 17.

So is there any reason not running the build with Java 21 in the first place, removing BREE and just let Tycho workout the target level itself? You won't even need a toolchains configuration then at all.

@Phillipus
Copy link
Author

BREE and <maven.compiler.target>21</maven.compiler.target> do not really make sense, any reason for this combination?

Copied and pasted from another project. Can be ignored.

So is there any reason not running the build with Java 21 in the first place, removing BREE and just let Tycho workout the target level itself? You won't even need a toolchains configuration then at all.

I have Java 17 installed as the system Java and was testing against Java 21 so thought this would work. It works OK if there are no feature projects so I thought this might be an issue worth reporting.

@laeubi
Copy link
Member

laeubi commented Nov 19, 2024

Features do not have any BREE obviously so they somehow fall back to the running JVM, this could probably be improved but its quite uncommon to run with a lower JVM but build for a higher JVM.

@Phillipus
Copy link
Author

Features do not have any BREE obviously so they somehow fall back to the running JVM, this could probably be improved but its quite uncommon to run with a lower JVM but build for a higher JVM.

Fair enough. I just reported it for completeness sake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants