eclipse-m2e / m2e-core

Eclipse Public License 2.0
110 stars 113 forks source link

Disable interactive archetype generation by default #1780

Open ridiculous-thought opened 3 months ago

ridiculous-thought commented 3 months ago

The checkbox "run archetype generation interactvely" was added to the "New Maven Project" wizard through commit 0b8f9607687196fae645a1d2c20a06ca655330c4. It is active by default, which means you have to interact with the console. If you have already filled out all the parameters in the wizard, this means an additional keystroke. Alternatively, you can of course deactivate the checkbox. But you have to remember to do that. The checkbox can also irritate users who are not aware of it. See https://stackoverflow.com/questions/74045604/can-not-create-a-maven-archetype-project-the-progress-bar-get-stuck-in-33. I think it would be better if the checkbox was either inactive by default or if there was a global setting for its default state.

laeubi commented 3 months ago

If you have already filled out all the parameters in the wizard

If you do that, then the console will show but should not ask for input, so this is a bit contradictory... beside that m2e don't control archetype generation so it might or might not work and even depend on maven and/or archetype version used.

ridiculous-thought commented 3 months ago

I'm really happy about the quick response. I didn't express myself clearly enough. My issue with the current default behavior is that the interactive modes forces me to confirm properties configuration whether the archetype requires any configuration at all or whether I provide all required values in the wizard. Take maven-archetype-webapp for example:

[INFO] Archetype repository not defined. Using the one from [org.apache.maven.archetypes:maven-archetype-webapp:1.4] found in catalog remote
[INFO] Using property: groupId = ridiculous.thought
[INFO] Using property: artifactId = mvntest
[INFO] Using property: version = 0.0.1-SNAPSHOT
[INFO] Using property: package = ridiculous.thought.mvntest
Confirm properties configuration:
groupId: ridiculous.thought
artifactId: mvntest
version: 0.0.1-SNAPSHOT
package: ridiculous.thought.mvntest
 Y: : 

I stopped working with Eclipse a few month before the introduction of the checkbox and only returned last week. I'm used to rely on the default configuration that the archetypes provide. With the current default behavior I need to either press enter in the console or remember to uncheck the checkbox. IMHO that's not the best user experience.

laeubi commented 3 months ago

We are effectively calling this goal:

https://maven.apache.org/archetype/maven-archetype-plugin/generate-mojo.html

as archetype is made for command line usage so we don't know what happens in general, there is not much m2e can do, the best would be to have an option to not ask for confirmation but still allow input (if required) but the mojo does not have such parameter, maybe this would be something to suggest to the authors of that plugin to not ask for confirmation of results.

Beside that we already have a way where we try to check if interactive is actually required in org.eclipse.m2e.core.ui.internal.wizards.MavenProjectWizardArchetypeParametersPage.validateInput(), so maybe a checkbox is not the best but we should have a radio selection instead that has

another good thing would be to simply remember the last selection of the user, maybe we can also make the console more prominent if interactive mode is selected?

If you like just propose a PR to improve this.

laeubi commented 3 months ago

IMHO that's not the best user experience.

Just wanted to clarify that before the interactive mode was introduced some archetypes simply failed (as they require interactive or m2e wasn't able to resolve all variable and so on) so whats bad for some user is good for others its always hard to find the best approaches.

ridiculous-thought commented 3 months ago

so whats bad for some user is good for others its always hard to find the best approaches

I get that.

There is a property called interactiveMode. If the checkbox is checked, interactiveMode is set to false and all other required properties have been set, Maven does not need an interaction with the console. I agree that a radio selection would probably be the better implementation. interactiveMode should be taken into account in some way. I do not plan to propose a PR, though. Instead I'm going to add interactiveMode as a required property to my archetypes' metadata and set its default value to false. This is a workaround that I can live with.

Thanks for your input. Feel free to close this issue if you don't think that changing the current implementation is worth the effort.