To be honest, I would just keep it the way it is right now. Otherwise you could remove the jakarta.hello part from the package. I don’t think the artifact ID is intended for the package name. It can be applied just to the war name. The package can be the same as the group ID.
Hi all,
just before year's end, I will throw a discussion into the round, where the answer seems to be a matter of taste rather than backed by any convention.
I currently work on adding groupId and artifactId in the UI with validation and respecting generated artifacts. I will leave the package name unchanged for now, but suppose
we'd have groupId and artifactId already, what would you expect that the Hello.java class would get as package name (and thereby folder structure)?
Example: groupId = com.mycompany artifactId = my-great-app
- com.mycompany.my-great-app.Hello (artifactId becomes
part of package unchanged)
- com.mycompany.mygreatapp.Hello (hyphons will be deleted, the rest becomes
part of package)
- com.mycompany.my.great.app.Hello (hyphons will be transformed to individual package parts)
- com.mycompany.Hello (no 2nd part of package, just the groupId)
- com.mycompany.something.else.Hello (user specifies the package separately in UI)
- com.mycompany.jakarta.hello.Hello (package name is fix, regardless what the user entered as artifactId)
Interestingly, if you compare with several other starters out there (Microprofile, Quarkus, Micronaut, SpringBoot), they all handle that differently.
Happy New Year,
Alex