IDEasy has build-in functionality to configure your IDE.
This allows to merge and manage complex configurations.
It is called configurator or also workspace merger and described in this section.
The easiest way is that you do not care.
When you launch the IDE of your choice (e.g. via ide eclipse, ide intellij, ide vscode), this will happen automatically.
If all is configured to your needs, then you have nothing to do.
Only if some specific configuration should be tweaked, you need to read on and figure out where to change or add what.
For every supported IDE we merge templates from a workspace folder in the order specified in configuration.
Here you will find the configuration templates in the following subfolders:
-
setup
A configuration location with the configuration only used to setup a workspace. After that the user remains control over these settings. So this is the place for recommendations that do not get in the way.
-
update
A configuration location with the configuration used to update and override. Contains settings that are overridden with every update and therefore enforced. If you manually change such configuration setting in the settings/preferences UI of your IDE, it will be reset on the next time the IDE gets started.
The configurator will recursively traverse the directory structure of these setup and update folders together.
For each located file «relative-path»/«file» it will create or update such file in the current workspace (by default workspaces/main/) according to the following rules:
-
If
«relative-path»/«file»is present in the current workspace it will be loaded and used as basis. -
Otherwise if
«relative-path»/«file»is present insetupit will be loaded and used as basis. -
If
«relative-path»/«file»is present inupdateit will be loaded and merged with the current basis. -
Variables in the from
$[«variable-name»]get resolved if«variable-name»is defined. Please note that in devonfw-ide the syntax was${«variable-name»}and legacy support for this can be enabled/disabled. However, this clashes with the variable syntax already used by IDE tools like Eclipse, IntelliJ, etc. Therefore this was changed in IDEasy and the new syntax should be used to avoid problems. -
If this caused any change the result is written to
«relative-path»/«file»in the current workspace.
In other words this means:
-
When your workspace configuration is initially created, it is empty. Hence, settings from
setupare used and merged withupdate. -
Settings in
setupare therefore used as initial defaults and suggestions but can be changed by the end-user (developer). Hence, usesetupfor things such as themes, UI tweaks, etc. Once the workspace is configuredsetupis typically not relevant anymore. -
Settings in
updateare applied on every restart of your IDE. If the user modifies such settings and reopens his IDE his changes are reverted. These such settings are managed and enforced for the project. Hence, useupdatefor things such as code-formatters, compiler options, paths to tools shipped withIDEasy, etc. that should be consistent and homogeneous for every team-member.
Unless you are already an expert and know where to tweak what, we recommend the following workflow to customize and tailor the IDE configuration to your needs:
-
Create a backup of your current IDE configuration. This can be found in your current workspace (typically
$IDE_HOME/workspaces/main) in according hidden subfolders. For Eclipse that subfolder is named.metadatafor Visual-Studio-Code this is.vscodeand for Intellij it is.ideaand.intellij. For Eclipse please also note from.metadatayou only need the.pluginssubfolder and the major configurations of interest are typically in.metadata/.plugins/org.eclipse.core.runtime/.settings/. And for IntelliJ, from the.intellijyou only need theconfigsubfolder and the major configurations are typically in.intellij/config/options. -
Start your IDE in the same workspace (e.g.
ide intellij, before that useicd -w «myworkspace»if you are not working inmainworkspace). -
Open the preferences or settings of your IDE and do the desired changes.
-
Exit your IDE again.
-
Create another backup of your current IDE configuration to a different folder (see first point).
-
Use a recursive merge tool (e.g. WinMerge) to compare the two backups and see what has actually been changed in the configuration files.
-
Once you have identified the correct path to the file containing the desired change and also the change itself inside the file, find the according file as a configuration template. This should typically be found in
$IDE_HOME/settings/«ide»/workspace/updateat the same relative path. In case there is no such configuration template file existing at all, you need to create it by copying the file from the second backup to your configuration location. Be wise to make your choice whether to put that intosetuporupdate. -
Now compare the file from the workspace with your template file and change your template to include the desired change.
-
Replace absolute paths and other configurable things using according variable expressions. E.g. replace
C:\Projects\myproject\software\mvn\bin\mvnwith$[IDE_HOME]/software/mvn/bin/mvn. -
Test your changes by opening your IDE again (ideally in another workspace) and verify that the desired setting is now properly configured. If that does not work, rework your changes. First thing is to check the updated configuration file in that workspace and see if it contains the expected change. If you cannot directly see the problem, continue the steps above to figure out what went wrong.
-
After you completed changes to configuration template(s) in your settings, commit them and share them with your team. Consider to follow feature-branches and pull-requests in larger teams for QA of such changes.
For workspace files in XML format we implemented a powerful XML Merger in IDEasy.
It allows control over how elements are combined, overridden, or kept intact during the merge process.
Especially IntelliJ uses a lot of XML configuration files.
In order to use the XML merger, it is necessary to declare the merge namespace in the root element like this:
<root xmlns:merge="https://github.com/devonfw/IDEasy/merge">
<!-- ... child elements here ... -->
</root>Do not worry: Everything related to this namespace will only exist in your template file and will be omitted in the merged file in your workspace.
The XML merger supports the following strategies, which can be specified for each element using the merge:strategy attribute:
-
combine: This strategy combines the source and target elements. It overrides text nodes and attributes, and recursively applies the process to child elements. If a source element exists in the target document, they are combined; otherwise, the source element is appended. -
override: This strategy replaces the target element with the source element, without considering child elements. If the element exists in the target, it is overridden; otherwise, it is appended. -
keep: This strategy keeps the existing target element intact if the source element exists in the target document. If the source element doesn’t exist in the target, it is appended.
The default strategy is combine and every element without a merge:strategy will inherit the strategy from its parent.
So you only need to configure a merge:strategy for an element if it shall be different from its parent.
Elements are identified and matched using the merge:id attribute.
This attribute is used to determine which elements in the source and target documents correspond to each other.
The merge:id can be set to one of the following:
-
An attribute name prefixed with @ (e.g.,
@id,@name) -
The string
name()to match by element name -
The string
text()to match by text content -
A full XPath expression (see e.g. this advanced example)
For each first occurrence of an element the provided value of merge:id is saved and then later used for elements with the same name (qualified tag name), so it is enough to provide a merge:id for each element only once, unless you want it to change later in the document.
If no merge:id was provided, the merger uses the following strategy as default:
-
If no attributes are present at all, use the qualified tag name
-
If an
idattribute is present use it (@id) -
Otherwise, if a
nameattribute is present use it (@name) -
Otherwise, if only a single attribute is present, that one will be used.
-
Else, you will get an error and need to adjust your template.
Since the defaults apply for most cases, you typically do not need to explicitly configure merge:id (convention over configuration).
Examples for the XML merger can be found in the following places: