diffplug / goomph

IDE as build artifact
Apache License 2.0
130 stars 30 forks source link

NPE when running P2AntRunner using the bootstrapper #185

Closed jonathan-meier closed 2 years ago

jonathan-meier commented 2 years ago

When running a P2AntRunner (e.g. created by P2Model.mirrorApp) via P2AntRunner.runUsingBootstrapper throws an NPE:

Caused by: java.lang.reflect.InvocationTargetException
        at com.diffplug.gradle.eclipserunner.JarFolderRunner.run(JarFolderRunner.java:51)
        at com.diffplug.gradle.eclipserunner.JarFolderRunnerExternalJvm$RunOutside.run(JarFolderRunnerExternalJvm.java:126)
        at com.diffplug.gradle.JavaExecable.main(JavaExecable.java:171)
Caused by: java.lang.NullPointerException
        at org.eclipse.ant.core.AntCorePreferences.findHighestAntVersion(AntCorePreferences.java:562)
        at org.eclipse.ant.core.AntCorePreferences.getDefaultAntHomeEntries(AntCorePreferences.java:507)
        at org.eclipse.ant.core.AntCorePreferences.getDefaultAntHome(AntCorePreferences.java:376)
        at org.eclipse.ant.core.AntCorePreferences.restoreAntHome(AntCorePreferences.java:365)
        at org.eclipse.ant.core.AntCorePreferences.restoreCustomObjects(AntCorePreferences.java:245)
        at org.eclipse.ant.core.AntCorePreferences.<init>(AntCorePreferences.java:225)
        at org.eclipse.ant.core.AntCorePlugin.setRunningHeadless(AntCorePlugin.java:240)
        at org.eclipse.ant.core.AntRunner.run(AntRunner.java:495)
        at org.eclipse.ant.core.AntRunner.start(AntRunner.java:611)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
        at com.diffplug.gradle.eclipserunner.EquinoxLauncher$Running.run(EquinoxLauncher.java:207)
        at com.diffplug.gradle.eclipserunner.EquinoxLauncher$Running.access$100(EquinoxLauncher.java:189)
        at com.diffplug.gradle.eclipserunner.EquinoxLauncher.run(EquinoxLauncher.java:180)

I tracked this down to a problem in the distributed bootstrapper (https://repo.diffplug.com/misc/goomph-p2-bootstrap/goomph-p2-bootstrap-4.13.0.zip). Something seems to have gone wrong when assembling this bootstrapper, because there is a version mismatch for the org.apache.ant plugin. According to the plugin directory as well as the manifest in there, the installed plugin has version 1.10.5.v20190526-1402. However, the plugin version specified in the simpleconfigurator configuration (in configuration/org.eclipse.equinox.simpleconfigurator/bundles.info) for the org.apache.ant plugin is 1.10.6.v20190516-0412.

This leads to the plugin not being loaded when running the AntRunner and therefore, no ant version can be found which then leads to the NPE.

Manually adjusting the version in bundles.info to 1.10.5.v20190526-1402 matching the plugin directory name resolves the issue.

This is likely the same issue as #144.

nedtwigg commented 2 years ago

Thanks for the detailed description. I uploaded a new goomph-p2-bootstrap-4.13.0.fix185.zip which has the workaround you described above, and I made it the default bootstrap version in Goomph 3.36.2. Hopefully this fixes the issue, let me know if it doesn't.

jonathan-meier commented 2 years ago

I can confirm that version 3.36.2 fixes this issue. Thank you! 👍