For development of Spring Boot applications, designing Jasper reports, writing regular Java applications and libraries build with Gradle, development of database scripts and DB management in general with DBeaver and development of C/C++ applications I use Eclipse with a few plugins. Now eclipse releases a new version every three month and I was always annoyed by the time consuming process of downloading and creating a new distribution that would fit my needs. Fortunately Eclipse offers a command to automate this process on the command line.
The theoretical part
For this script to work Java has to installed and available in the global path.
This chapter shows the command line options:
-application org.eclipse.equinox.p2.director
This parameter takes two more arguments.
-repository $RepoListStr
-installIU $FeatureListStr
$RepoListStr is a list of repository urls separated by “,”.
$FeatureListStr is a list of features to install separated by “,”.
$FeatureList = "org.eclipse.epp.mpc.feature.group,org.eclipse.buildship.feature.group,..."
$Repos = "https://download.eclipse.org/releases/2021-12,https://download.eclipse.org/eclipse/updates/4.22,..."
In the end the full command looks like this:
eclipse.exe -application org.eclipse.equinox.p2.director -repository $RepoListStr -installIU $FeatureListStr
The script
I have published the full installer in my GitHub repository. The script can be altered and features can be added and removed if needed. I tried to document the features I need the most.
Feature IDs
Now how do you get the feature ids for your desired components? The easiest way is on a already installed environment following this path:
Repositories
And how do you get the corresponding repositories for the repository array? Again on a already installed system:
Additional configuration
The script also alters the memory configuration to a initial size of 1GB and a maximum consumption of 4GB in “eclipse.ini”. Without this I ran in a “OutOfMemory” exception a few times. Further more automatic updates are enabled. This should be removed if the IDE is installed under “%ProgramFiles%” and UAC is enabled.
Troubleshooting
Sometimes a repository is missing or something goes wrong. Then features are missing. This can be detected in a certain log file. In the temporary directory Eclipse is extracted in and which is opened when the script has finished there is a folder “configuration” that contains files in the form of “<timestamp>.log”. For example: 1640808421484.log
This file then shows a message like the following:
This means that a certain dependency could not be found. I’ll show one way to fix this. Search for the problem causing library:
Open the hit that leads to the eclipse page and copy the link:
Paste the copied link into the address bar and remove the highlighted part:
Open the page:
This is the eclipse update page. Copy the URL and add it the “Repos” array:
Rerun the script. Now the library should be found. This can be repeated if more errors occur.