Month: December 2021

  • Eclipse bundle creator

    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.

  • Setup Msys2 automatically

    Some time ago I wrote a short post on “How to develop a 64bit C application on Windows 10 with Visual Studio Code“.

    To be honest´it is a little bit tricky setting up the development environment, with gcc, gdb, make and other required tools. So I have extended my automated installation script.

    This script will:

    • Install Msys2 in “%LocalAppData%\Programs\Msys2” (Under your user directory. Thus, no admin privileges are required.
    • Install all the required tools for development like compiler, linker, debugger, etc.
    • Update everything to the latest version.

    If you download the file from the repository it is possible that PowerShell will ask you if you really want to run the file. You can prevent this from happening with the following command:

    Unblock-File -Path install.ps1
    Are you sure you want to perform this action?
    Performing the operation "Unblock-File" on target "C:\Users\Path\to\download\directory\install.ps1".
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

    There will be a console windows flashing up a few times. When everything is done the regular prompt of PowerShell is shown.