Eclipse support for Glassfish 5

Flocke picture Flocke · Oct 5, 2017 · Viewed 8.1k times · Source

Does anyone know if there will be support for GlassFish 5 in Eclipse in nearer future (GlassFish Tools supports 3.1 and 4.x)?

Is there another way to integrate Glassfish in Eclipse besides GlassFish Tools?

Answer

Arjan Tijms picture Arjan Tijms · Nov 18, 2017

GlassFish Tools just checks for a version as follows:

Version version = getVersion();

if (!version.matches("[3.1-5)")) {
    return new Status(Status.ERROR, GlassfishToolsPlugin.SYMBOLIC_NAME, Messages.unsupportedVersion);
}

Where getVersion() is obtained from reading [install dir]/glassfish/modules/glassfish-api.jar!META-INF/MANIFEST.MF and then the Bundle-Version entry.

So a hacky way to get Eclipse working with GlassFish 5 and Payara 5 is:

  1. cd [install dir]/glassfish/modules/
  2. mkdir META-INF
  3. unzip -p glassfish-api.jar META-INF/MANIFEST.MF > META-INF/MANIFEST.MF
  4. vim META-INF/MANIFEST.MF
  5. Change Bundle-version to start with a 4 and make sure digits are all single (i.e. 181 should become 0 or so)
  6. zip -u glassfish-api.jar META-INF/MANIFEST.MF

Now you can add a runtime and server for GlassFish 5 and Payara 5 as you would normally do, and start, debug, deploy etc.

For illustration, the entry to be changed looks as follows:

Bundle-Name: Public APIs of Glassfish
Bundle-Version: 5.181.0.Alpha4-SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Build-Jdk: 1.8.0_144

Should become:

Bundle-Name: Public APIs of Glassfish
Bundle-Version: 4.0.0.Alpha4-SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Build-Jdk: 1.8.0_144

The GlassFish tooling is currently in proposal to be donated to Eclipse, so it may take a while to be updated. Meanwhile, I'm planning to create a derivative version before long with some extra enhancements, but that too may take some time.