How To Install a Fast & Small Eclipse IDE

Eclipse 2022-09 has just been launched these days and this is a good moment to talk about the IDE and the installation.

I always have the problem that my Eclipse IDE is polluted with countless plugins that I do not use and that make working with Eclipse rather tougher. So in this blog I will shortly give my recommendation how to install a fast & small Eclipse IDE.

Continue reading “How To Install a Fast & Small Eclipse IDE”

OpenLiberty and Hot-Deployment

The OpenSource application server OpenLiberty from IBM is very suitable for running microservices and web applications in production. But also for development, the server offers a very good support of autodeploy and hotdeployment.

Per default you can simply drop a new .war file into the folder /config/dropins/ and OpenLiberty will immediately deploy your application. You can configure the behavior of dropins in detail in the server.xml file.

For example, if you add the following tag into your server.xml file:

...
 <applicationManager autoExpand="true" />
....

then your application will be automatically expanded into a new folder at

${server.config.dir}/apps/expanded/APP_NAME/

Now when you deploy your application you will have a file layout like this:

./server.xml
./dropins/myapplication.war
./apps/expanded/myapplication.war/my-page.jsf
./apps/expanded/myapplication.war/WEB-INF/classes/com/foo/SomeAppClass.class

In case you use autoexpand=true than the “active” set of files will be the files under the apps/expanded/ folder which you can then hot-update. This approach is useful if you want to deploy a single .war file and then make tweaks to it after you deploy it, such as in dev mode.

javax.faces.PROJECT_STAGE

Note that the hot-deployment for JSF files is only working if your PROJECT_STAGE param is set to ‘development’. So if not yet activated add the following into your web.xml file:

<context-param>
	<param-name>javax.faces.PROJECT_STAGE</param-name>
	<param-value>Development</param-value>
</context-param>

For production it is recommended to set the parameter to ‘Production’. In this mode JSF files will be cached by OpenLiberty internally.

Alternatively you can set the param ‘javax.faces.FACELETS_REFRESH_PERIOD’ to 1 which will also force OpenLiberty to scann for changed JSF files and class files:

<context-param>
 	<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
    	<param-value>1</param-value>
</context-param>

Manik Hot-Deply Plugin

With the Eclipse Hot-Deploy Plugin ‘Manik’ you can enable autodeploy and hot-deploy easily for OpenLiberty.

If you use the Option ‘Explode Artifacts’ you can deploy the .war as a folder directly into the /config/dropins/ folder of your OpenLiberty installation. The Hotdeployment directory is than the .war/ sub directory after the first deployment. You can disable the ‘autoExpand’ feature of OpenLiberty in this case. See also the discussion here.

Payara Autodeploy with the Eclipse Manik Plugin

Manik-Hot-Deploy is a plugin for the Eclipse IDE which brings auto-deploy and hot-deploy functionallity to the development of web applications. The plugin is Open Source and supports Glassfish, Payara, JBoss, Wildfly and other application servers.

With the latest Release 1.0.6 the plugin improves the Payara Autodeploy support. The new version provides a setting for the target folder with a default setting for maven projects.

To enable the autodeploy feature for Payara you also have to set ‘autodeploy-enabled=true in the ‘das-config’ section of the domain.xml file.

<das-config dynamic-reload-enabled="true" autodeploy-enabled="true"></das-config>

Also hot-deployment is supported for Payara, Wildfly and other application servers. Find the full details on the Wikipage on Github.

XSLT 2.0 with Eclipse and Wildfly

Eclipse IDE provides a cool feature which allows you to execute XSL templates within the IDE. You just need to select the XSL file together with the XML file and choose from the context menu

Run As -> XSL Transformation

But for some reasons Eclipse is not supporting XSL 2.0 – which is standard in these days. So for example if you try to use xsl functions like ‘format-date-time’ or ‘replace’ this will not work. This is also true for Wilfly application server. So here is how to add XSLT 2.0 support for both – Eclipse and Wilffly

Eclipse IDE

You can install an XSLT 2.0 processor manually into your Eclipse IDE:

  1. Download the latest Saxon XSLT processor
  2. Unzip the package to get the saxon9he.jar file and place it into your workspace or some external folder
  3. In eclipse choose “Window > Preferences” then “XML > XSL > Java Processors > Add”
  4. Fill in a “Processor Name”, e.g. “Saxon XSLT 2.0”
  5. In field “Processor type” choose “Saxon (XSLT 2.0)”
  6. Choose “Add external jar” and choose your saxon jar, e.g. “saxon9he.jar”
  7. Confirm by clicking “OK”

Now you can use saxon for XSLT 2.0 transformations in Eclipse. You need just configure your Run As Configurations and select the option ‘use specific process‘ to select the newly added Saxon processor.

Wildfly Sever

Also wildfly server supports only XSL 1.0 per default. If you need XSL 2.0 in your application add the following maven dependency:

        <!-- XSL 2.0 support-->
        <dependency>
            <groupId>net.sf.saxon</groupId>
            <artifactId>Saxon-HE</artifactId>
            <version>9.8.0-14</version>
        </dependency>


Eclipse: Avoid Validation of Maven /target Folders

In eclipse maven project it’s annoying that Eclipse IDE always validates all files from the /target/ folders – which makes no sense in any case.

To avoid this validation you can disable the specific validator in the workspace preferences. Go to validators and edit the XML and JSF Validator and add a ‘Exclude Group – Rule’ for the folder

/target

You can also exclude specific files. In my case I exclude the file

glassfish-application.xml

Eclipse Luna crashes on Ubuntu

Today I had strange problems with Eclipse Luna after an Ubuntu Update.
The solution was changing the eclipse.ini by adding

-Dorg.eclipse.swt.browser.DefaultType=mozilla

and changing the memory settings.
Thanks to Bård Aase Blog: http://blog.elzapp.com/2014/07/01/making-eclipse-kepler-and-luna-work-on-ubuntu.html

Eclipse Mars on Debian Jessie with Gnome 3

After downloading the new Eclipse IDE Mars I was disappointed of the corrupted design. Several dialog pages did not work as expected or were empty until the dialog window was resized.

eclipse_mars_properties_dialog_bpmn

As Eclipse release 4.5 (Mars)  is based on GTK 3, the problem in my case was the missing library “gtk3-engines-oxygen”. This it the so called Oxygen widget theme for GTK3-based applications like the Eclipse Mars release.

After installing the missing library with apt:

apt-get install gtk3-engines-oxygen

the Eclipse Mars Release works perfect!

eclipse_mars_gtk_screen_11

Customize Eclipse them Jeeeyul’s Eclipse Themes

A very nice plug-in for Eclipse is the ‘Jeeeyul’s Eclipse Themes‘.  This plug-in provides a set of cool themes for eclipse and also a cool editor to customize the theme individually.

Adjusting the window margins

Another annoying thing in Eclipse GTK with Gnome is the small margin between to windows so you cant grasp the space with the mouse to resize the view.This problem can also be solved directly with the Jeeeyul’s plug-in:

In the ‘General’ section of the Jeeeyul’s Themes section you can change the “Winddow Pacing”. Disable the option ‘Cast Shadow’ and set ‘Part Stack Spacing’ to 5 and ‘Margins’ to 0. After that you need to restart Eclipse.

Alternative: Disable GTK3

An alternative is to simply deactivate GTK3 for Eclipse Mars. You need to set the environment variable ‘SWT_GTK3’ to ‘0’.

I am using the following bash start script to launch Eclipse Mars:

#!/bin/bash
cd /opt/eclipse-jee-mars/
export SWT_GTK3=0
./eclipse

See also the comments below.