bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
526 stars 304 forks source link

Cannot create new Bnd OSGi Project with current master HEAD #6077

Closed scottslewis closed 2 months ago

scottslewis commented 3 months ago

I've pulled the latest from master and am testing bndtools locally.

It starts up fine and I create a New Bnd Workspace (Deprecated)...using bndtools.workspace.min template. This (bnd workspace creation) works fine.

Then I try to create a New Bnd OSGi Project using the new project wizard. After giving project name and hitting finish the following error is displayed:

image

Further, the following is output to log


Welcome to Apache Felix Gogo

g! 2024-04-07 14:12:48,961 [HttpClient,https://api.github.com/repos/bndtools/bndtools.workspace.min] INFO a.bnd.build.LoggingProgressPlugin - Download https://api.github.com/repos/bndtools/bndtools.workspace.min 2024-04-07 14:12:48,961 [HttpClient,https://api.github.com/repos/bndtools/workspace] INFO a.bnd.build.LoggingProgressPlugin - Download https://api.github.com/repos/bndtools/workspace 2024-04-07 14:12:59,543 [Bnd-Executor,pool-3-thread-1] INFO a.b.r.server.RemoteWorkspaceServer - Registering remote workspace server C:\Users\slewi\git\bnd\bndtools.test\workspace.xxxxx\cnf\cache\remotews\55379 2024-04-07 14:12:59,589 [Bnd-Executor,pool-3-thread-1] INFO a.b.r.server.RemoteWorkspaceServer - Registering remote workspace server C:\Users\slewi\git\bnd\bndtools.test\workspace.xxxxx\cnf\cache\remotews\55380 2024-04-07 14:12:59,589 [Bnd-Executor,pool-3-thread-1] INFO a.b.r.server.RemoteWorkspaceServer - Closing remote workspace server C:\Users\slewi\git\bnd\bndtools.test\workspace.xxxxx\cnf\cache\remotews\55379 2024-04-07 14:12:59,590 [Bnd-Executor,pool-3-thread-1] INFO aQute.lib.link.Link - Closing link remotews 2024-04-07 14:12:59,591 [remotews] INFO aQute.lib.link.Link - Exiting link remotews 2024-04-07 14:12:59,601 [Bnd-Executor,pool-3-thread-1] INFO a.b.r.server.RemoteWorkspaceServer - Registering remote workspace server C:\Users\slewi\git\bnd\bndtools.test\workspace.xxxxx\cnf\cache\remotews\55381 2024-04-07 14:12:59,601 [Bnd-Executor,pool-3-thread-1] INFO a.b.r.server.RemoteWorkspaceServer - Closing remote workspace server C:\Users\slewi\git\bnd\bndtools.test\workspace.xxxxx\cnf\cache\remotews\55380 2024-04-07 14:12:59,610 [Bnd-Executor,pool-3-thread-1] INFO aQute.lib.link.Link - Closing link remotews 2024-04-07 14:12:59,611 [remotews] INFO aQute.lib.link.Link - Exiting link remotews 2024-04-07 14:13:25,315 [Worker-10: Auto share git projects] ERROR org.eclipse.equinox.logger - Connecting Git team provider failed. See log for details. 2024-04-07 14:13:25,400 [main] ERROR org.eclipse.equinox.logger - Error generating project content from template java.io.IOException: Error generating project contents from template "«Empty»": Attempting to create container P/minnie of type Project, can only create plain Folder containers. at bndtools.wizards.project.NewBndProjectWizard.generateProjectContent(NewBndProjectWizard.java:210) at bndtools.wizards.project.AbstractNewBndProjectWizard.lambda$1(AbstractNewBndProjectWizard.java:193) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2380) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2400) at bndtools.wizards.project.AbstractNewBndProjectWizard.lambda$0(AbstractNewBndProjectWizard.java:201) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:434) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:352) at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1034) at bndtools.wizards.project.AbstractNewBndProjectWizard.performFinish(AbstractNewBndProjectWizard.java:188) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:833) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:473) at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619) at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4251) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645) at org.eclipse.jface.window.Window.runEventLoop(Window.java:823) at org.eclipse.jface.window.Window.open(Window.java:799) at org.eclipse.ui.internal.actions.NewWizardShortcutAction.run(NewWizardShortcutAction.java:130) at org.eclipse.jface.action.Action.runWithEvent(Action.java:474) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:580) at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:414) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4251) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.bndtools.applaunch.BndApplicationLauncher.lambda$0(BndApplicationLauncher.java:34) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at aQute.launcher.Launcher.handleMainCallable(Launcher.java:464) at aQute.launcher.Launcher.launch(Launcher.java:437) at aQute.launcher.Launcher.run(Launcher.java:185) at aQute.launcher.Launcher.main(Launcher.java:161) at aQute.launcher.pre.EmbeddedLauncher.executeWithRunPath(EmbeddedLauncher.java:169) at aQute.launcher.pre.EmbeddedLauncher.findAndExecute(EmbeddedLauncher.java:134) at aQute.launcher.pre.EmbeddedLauncher.main(EmbeddedLauncher.java:51)

Could this be somehow related to the recent changes for bnd workspace template fragments? FWIW, the new service wizard fails to create the projects with similar errors also, so perhaps something about the NewBndProjectWizard (or wizard pages) changed?

scottslewis commented 3 months ago

More info on this: If the workspace is not created under the bndtools/bnd repo location the git error goes away, but the other error does not

image

Here's the log output


Welcome to Apache Felix Gogo

g! 2024-04-07 14:39:31,358 [HttpClient,https://api.github.com/repos/bndtools/workspace] INFO a.bnd.build.LoggingProgressPlugin - Download https://api.github.com/repos/bndtools/workspace 2024-04-07 14:39:31,358 [HttpClient,https://api.github.com/repos/bndtools/bndtools.workspace.min] INFO a.bnd.build.LoggingProgressPlugin - Download https://api.github.com/repos/bndtools/bndtools.workspace.min 2024-04-07 14:39:37,815 [Bnd-Executor,pool-3-thread-1] INFO a.b.r.server.RemoteWorkspaceServer - Registering remote workspace server C:\Users\slewi\workspace.test.xxxx\cnf\cache\remotews\55625 2024-04-07 14:39:37,868 [Bnd-Executor,pool-3-thread-1] INFO a.b.r.server.RemoteWorkspaceServer - Registering remote workspace server C:\Users\slewi\workspace.test.xxxx\cnf\cache\remotews\55626 2024-04-07 14:39:37,868 [Bnd-Executor,pool-3-thread-1] INFO a.b.r.server.RemoteWorkspaceServer - Closing remote workspace server C:\Users\slewi\workspace.test.xxxx\cnf\cache\remotews\55625 2024-04-07 14:39:37,870 [Bnd-Executor,pool-3-thread-1] INFO aQute.lib.link.Link - Closing link remotews 2024-04-07 14:39:37,870 [remotews] INFO aQute.lib.link.Link - Exiting link remotews 2024-04-07 14:39:37,885 [Bnd-Executor,pool-3-thread-1] INFO a.b.r.server.RemoteWorkspaceServer - Registering remote workspace server C:\Users\slewi\workspace.test.xxxx\cnf\cache\remotews\55627 2024-04-07 14:39:37,886 [Bnd-Executor,pool-3-thread-1] INFO a.b.r.server.RemoteWorkspaceServer - Closing remote workspace server C:\Users\slewi\workspace.test.xxxx\cnf\cache\remotews\55626 2024-04-07 14:39:37,888 [Bnd-Executor,pool-3-thread-1] INFO aQute.lib.link.Link - Closing link remotews 2024-04-07 14:39:37,888 [remotews] INFO aQute.lib.link.Link - Exiting link remotews 2024-04-07 14:39:58,812 [main] ERROR org.eclipse.equinox.logger - Error generating project content from template java.io.IOException: Error generating project contents from template "«Empty»": Attempting to create container P/minnie of type Project, can only create plain Folder containers. at bndtools.wizards.project.NewBndProjectWizard.generateProjectContent(NewBndProjectWizard.java:210) at bndtools.wizards.project.AbstractNewBndProjectWizard.lambda$1(AbstractNewBndProjectWizard.java:193) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2380) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2400) at bndtools.wizards.project.AbstractNewBndProjectWizard.lambda$0(AbstractNewBndProjectWizard.java:201) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:434) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:352) at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1034) at bndtools.wizards.project.AbstractNewBndProjectWizard.performFinish(AbstractNewBndProjectWizard.java:188) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:833) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:473) at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619) at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4251) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645) at org.eclipse.jface.window.Window.runEventLoop(Window.java:823) at org.eclipse.jface.window.Window.open(Window.java:799) at org.eclipse.ui.internal.actions.NewWizardShortcutAction.run(NewWizardShortcutAction.java:130) at org.eclipse.jface.action.Action.runWithEvent(Action.java:474) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:580) at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:414) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4251) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.bndtools.applaunch.BndApplicationLauncher.lambda$0(BndApplicationLauncher.java:34) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at aQute.launcher.Launcher.handleMainCallable(Launcher.java:464) at aQute.launcher.Launcher.launch(Launcher.java:437) at aQute.launcher.Launcher.run(Launcher.java:185) at aQute.launcher.Launcher.main(Launcher.java:161) at aQute.launcher.pre.EmbeddedLauncher.executeWithRunPath(EmbeddedLauncher.java:169) at aQute.launcher.pre.EmbeddedLauncher.findAndExecute(EmbeddedLauncher.java:134) at aQute.launcher.pre.EmbeddedLauncher.main(EmbeddedLauncher.java:51)

scottslewis commented 2 months ago

Thanks for the fix. I imagine we are both happy this was easy to fix. I will test the fix shortly.

One question. What do you mean by this comment on the commit https://github.com/pkriens/bnd/commit/4702f68a8ca80db8896f9efdc33e91cd629002b0

I would like to remove the Java Wizard since we have all our details in the cnf/build.bnd

Are you referring to the Bnd OSGi Project Wizard as the 'Java Wizard', or something else? One reason I'm asking...there is now (7.1) a Java OSGi Service Wizard.

Just a general (probably obvious) usability point: It's generally a bad idea to deprecate (and remove) functionality that users (particularly new users) have/currently depend upon to do anything with the tool...especially without public warnings. In this context I'm referring to Bnd's new workspace and new project wizards (or any wizards/ui that have been used over several previous versions of tooling).

pkriens commented 2 months ago

We inherit the Java wizard but we only need the project name from it. Java release, modules, file path, etc should come from the workspace. In the long run I'd like to import and store on git a pure bnd workspace without .classpath & .project since they are redundant and sometimes in conflict with the bnd information.

The create project page could be a simple Dialog that only asks for a name. When we then call Workspace.createProject(name), everything is done for us and an Eclipse project will show up with the correct information from the workspace. It would greatly simplify and remove a lot of error cases from the scenario.

I've hesitated to do this now because it feels like a big step. However, we really do not use anything else from the Java wizard.

Feedback very much appreciated.

pkriens commented 2 months ago

Deprecate is a warning that indicates it is fine to use but we've got a better model. You're one of the people that heavily complained how complicated the current model is and error prone. You're analysis how complicated it was to make a new workspace drove this work. When I saw that I was wondering how many people were using it since it seemed unworkable and I myself had a tendency to avoid it, and I had the impression others were doing the same.

We're not in a release cycle so I am open to input here. I can change the text for the old 'new workspace' wizard to classic instead of deprecated. But we can't improve unless we change.

scottslewis commented 2 months ago

Deprecate is a warning that indicates it is fine to use but we've got a better model. You're one of the people that heavily complained how complicated the current model is and error prone. You're analysis how complicated it was to make a new workspace drove this work. When I saw that I was wondering how many people were using it since it seemed unworkable and I myself had a tendency to avoid it, and I had the impression others were doing the same.

We're not in a release cycle so I am open to input here. I can change the text for the old 'new workspace' wizard to classic instead of deprecated. But we can't improve unless we change.

I understand deprecation just fine. But whether justified or not, a lot of people don't understand it...particularly new users (the very ones I think would be most important to appeal to when growing a user base).

One observation after being an Eclipse committer for 20+ years: Having existing/familiar/used UI change (even for the better) can be disconcerting and even intimidating. This is all I'm trying to say above. This doesn't mean that new/better/more extensible/scalable mechanism shouldn't be introduced, but rather that time for the user community to adjust can be helpful when the existing UI is 'familiar'...or even UI just to aid in the transition.

FWIW, I think this is reason enough to introduce changes at this level (naming and workspace and project creation) gradually rather than all at once. Example: The OSGi Java Project wizard...yes bndtools can/could get away with a very simple wizard (just a name). My own opinion, though, in short term is that it's actually ok as it is...precisely because it looks very much like the Plain ol' Java Project wizard...which is probably used frequently by almost every user of Eclipse. Yes a single field (name) project might be 'simpler', but just the familiarity a bnd project creator gets (i.e. 'I've seen this before...looks just like creating a Java project being created) isn't terrible. I also understand that it can cause issues wrt .classpath/.project and bnd meta-data and it would perhaps have been better if that JavaProjectWizard hadn't been the superclass for BndNewProjectWizard at all...but that's water under the bridge, and at least people are used to it.

So I'm not arguing against change/improvement. To the contrary. However, for UI...especially for those new users...sometimes stability matters too.

WRT the new workspace wizard naming...I would be inclined to:

1) Keep the existing New Bnd Workspace wizard name (i.e. not with 'deprecated' or even 'classic') 2) Have the New Bnd Workspace (fragments) wizard menu item use something like: New Bnd Workspace (fragments) 3) After a release or so (when fragments stuff ready and tested) switch 1 for 2 and change (fragments) to (classic)

Another approach

1) Keep just one New Bnd Workspace menu item 2) When it's chosen...while there are both 'classic' and 'new new bnd workspace' wizards...have a dialog or wizard page that simply asks them to decide to use 'classic' or 'new new' (not good names for the page obviously) and then programmatically launch the appropriate wizard. 3) Doing this way allows you to...at some point in the future...keep both around forever, or remove the old/existing one and simply remove the choice dialog, or even have additional ways to create a new bnd workspace (e.g. provide a workspace template...or template fragments URLs?).