Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Automatically change the compiler level
Automatically change the compiler level [message #1865946] Wed, 15 May 2024 20:07 Go to next message
Kaan Yandas is currently offline Kaan YandasFriend
Messages: 2
Registered: May 2024
Junior Member
Hello, we use Eclipse IDE (4.13) and Git as version control system. Due to a Java update from 1.8 to 17, the different software versions (Git branches) must be compiled with the corresponding compiler level (1.8 or 17) in Eclipse. This is necessary because the class files for our patch process still have to be created manually. This means that if you switch between the Git branches, the compiler level (the correct one) must be set manually in Eclipse. Is there a way to automate this in Eclipse?
Something like this: If you switch to branch x, the correct compiler level is set automatically.

Thanks in advance!
Re: Automatically change the compiler level [message #1865964 is a reply to message #1865946] Thu, 16 May 2024 13:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33264
Registered: July 2009
Senior Member
Such settings can be stored per-project and checked into Git, e.g.,

https://github.com/eclipse-emf/org.eclipse.emf/blob/master/plugins/org.eclipse.emf.common/.settings/org.eclipse.jdt.core.prefs
https://github.com/eclipse-emf/org.eclipse.emf/blob/master/plugins/org.eclipse.emf.common/.classpath


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Automatically change the compiler level [message #1865967 is a reply to message #1865946] Thu, 16 May 2024 14:12 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4507
Registered: July 2009
Senior Member

The preference page where you set this for the workspace has a corresponding page
in the project's Properties dialog. You can set the compiler level into the project itself,
where it will be stored in the project's .settings folder. Commit that into your branches
and it should behave as you've asked.


_
Nitin Dahyabhai
Eclipse Web Tools Platform

[Updated on: Thu, 16 May 2024 14:19]

Report message to a moderator

Re: Automatically change the compiler level [message #1865976 is a reply to message #1865946] Thu, 16 May 2024 20:26 Go to previous message
Kaan Yandas is currently offline Kaan YandasFriend
Messages: 2
Registered: May 2024
Junior Member
Thank you. I will try out your approaches
Previous Topic:navigate -> go to -> package is disabled
Next Topic:remember and restore tree portion of the IDE when re-opening
Goto Forum:
  


Current Time: Thu Jan 23 21:52:25 GMT 2025

Powered by FUDForum. Page generated in 0.03519 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top