Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Generate from Maven Archetype" to propose archetype version, by semantic-version ordering #354

Closed
tarilabs opened this issue Jun 26, 2019 · 3 comments
Labels
feature-request New feature or request
Milestone

Comments

@tarilabs
Copy link

Suggestion

In the "remote archetype catalog" from Maven central[1] the archetypes are not ordered by semantic version scheme, just by lexicographic ordering of the artifcat version.
The mvn command used by this extension[2] if not supplied with an archetype version will pick the first one from the catalog xml, which is not necessarily the most up-to-date.

Please consider for the VSCode extension to propose the user, after having selected a specific archetype, to confirm which version to use (if more than 1 version in catalog) and list the versions by semantic-version order. Finally, passing down archetypeVersion to the mvn command used in turn.

[1] warning, big xml file ! https://repo1.maven.org/maven2/archetype-catalog.xml
[2] mvn archetype:generate -DarchetypeArtifactId="myArtifactId" -DarchetypeGroupId="myGroupId"

Use Cases

When an archetype is released to maven central in multiple version, and as commonly used semantic-version is used for naming a version. E.g.: by remote archetype catalog a version like 7.9 is always first in the file if compared to version 7.23

Examples

In the VSCode extension, after having selected a given artifact, do list all the available versions for that artifact and ordered by semantic-version order, not lexicographic order.
Pass down the selection to the mvn command used by this extension.
E.g.: from today like

mvn archetype:generate -DarchetypeArtifactId="myArtifactId" -DarchetypeGroupId="myGroupId"

to

mvn archetype:generate -DarchetypeArtifactId="myArtifactId" -DarchetypeGroupId="myGroupId"  -DarchetypeVersion=" *** selected version here *** "

Thanks in advance for considering this

@Eskibear
Copy link
Member

We assumed that, by not specifying the version it would pick the latest version of the archetype, and most people would prefer the latest one. But now it seems we were wrong...

list the versions by semantic-version order

It makes sense and it's feasible.

warning, big xml file !

Exactly. That's why we update and prepack it as a compressed .json file, much more smaller in size. Please share if you have any other suggestion for fetching the metadata.

BTW, besides listing the archetype versions, I was thinking also to prompt input boxes for groupId and artifactId, and turn off interactiveMode. The advantage would be:

  • users don't need to wait for some time and then input the groupId, etc. in the terminal.
  • launching the command as a child process, the extension knows when the project is created, and can provide further help, e.g. guide users to open the project.
    The disadvantage would be:
  • users are not be able to specify archetype-specific parameters.

@tarilabs Any thoughts on this?

@Eskibear Eskibear added the feature-request New feature or request label Jun 27, 2019
@Eskibear Eskibear added this to the 0.18.0 milestone Jun 27, 2019
@tarilabs
Copy link
Author

Thanks for the prompt reply @Eskibear !

It makes sense and it's feasible

Awesome!

Please share if you have any other suggestion for fetching the metadata.

Not particularly, I guess it's acceptable for the remote catalog refresh to take the needed (network) time

BTW, besides listing the archetype versions, I was thinking also to prompt input boxes for groupId and artifactId, and turn off interactiveMode.
...
The disadvantage would be:

  • users are not be able to specify archetype-specific parameters.

This could be an issue for some archetypes. What about having this as a default, but support the "input archetype parameters via interactiveMode" as a configuration option in this extensions?
In other words for the extension to behave by default in the way you describe, but support the current interactiveMode as of today by changing an extension configuration option?

Alternatively, but this would require more efforts, the extension could inspect the archetype for the archetype parameters and prompt for them, in order to later supply them via command line, I believe this is feasible as other IDEs like Eclipse IDE have the user supply archetype parameters, the one specifically related to the selected archetype, in a special dialog window --they are also pre-populated with the correct archetype parameter values by default

In any case, thank you!

@Eskibear
Copy link
Member

Eskibear commented Jul 1, 2019

I'll add archetype version support in the coming version.
About interactiveMode vs batchMode, I think it's better not to change current behavior until the new behavior has good coverage. I might take some time to investigate the effort of inspecting archetype for parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants