Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [starter-dev] Package name of demo code

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.

If you want to do some validation to ensure the package name is proper in the archetype, that’s always a good thing: https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html.


From: starter-dev <starter-dev-bounces@xxxxxxxxxxx> on behalf of Alexander Rühl via starter-dev <starter-dev@xxxxxxxxxxx>
Sent: Sunday, December 31, 2023 7:47 AM
To: starter-dev@xxxxxxxxxxx <starter-dev@xxxxxxxxxxx>
Cc: Alexander Rühl <alexander.ruehl@xxxxxxxxxxxxxxxx>
Subject: [starter-dev] Package name of demo code
 
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
  1. com.mycompany.my-great-app.Hello   (artifactId becomes part of package unchanged)
  2. com.mycompany.mygreatapp.Hello   (hyphons will be deleted, the rest becomes part of package)
  3. com.mycompany.my.great.app.Hello   (hyphons will be transformed to individual package parts)
  4. com.mycompany.Hello   (no 2nd part of package, just the groupId)
  5. com.mycompany.something.else.Hello   (user specifies the package separately in UI)
  6. 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


Back to the top