pmlopes / vertx-starter

POC for vert.x starter project
https://vertx-starter.jetdrone.xyz
42 stars 15 forks source link

Maven & Gradle projects should use the associated plugins #45

Open InfoSec812 opened 5 years ago

InfoSec812 commented 5 years ago

When creating a Vert.x project using Maven or Gradle, the project should implement the corresponding plugins fabric8io/vertx-maven-plugin or jponge/vertx-gradle-plugin.

pmlopes commented 5 years ago

I think we need to rework the templates. Currently we have many templates:

The templates got really complex as templates are shared across projects (the pom.xml is used by anything that does maven so it starts to be spaghetti with lots of if-else constructs.)

I think we can do better, I think we could try to use the examples repo to source the examples and all the web projects should avoid custom builds but settle on the create-react-app, create-ng-app, etc... so the cost of maintenance is lower.

This however still has the issue that the root: pom.xml, build.gradle needs to be created here as the pom's from the examples repo are not usable in a real life project.

Also projects should use a bill of materials (BOM) to avoid the specification of the version all the time.

If this is a good idea, we could list here which examples are a good starter and we can try to create an import script to have them on the app.

WDYT @InfoSec812 @slinkydeveloper ?

pmlopes commented 5 years ago

I'm also inclined to drop SBT as honestly I got it to work for the hello world example but I've no idea how to maintain it... and for NPM I'll default to https://reactiverse.io/es4x/ as it feels more natural to js developers than the current vert.x 3 way...

slinkydeveloper commented 5 years ago

I think we can do better, I think we could try to use the examples repo to source the examples and all the web projects should avoid custom builds but settle on the create-react-app, create-ng-app, etc... so the cost of maintenance is lower.

For the web app codegen I agree. For openapi templates too I want to delegate java models codegen to another external gen http://www.jsonschema2pojo.org/

If this is a good idea, we could list here which examples are a good starter and we can try to create an import script to have them on the app.

If I understand correctly your idea, I think that loading with a script from examples' pom.xml and then use a couple of regex to substitute things is complex too to mantain. A change in vertx-examples repo breaks this codegen. I have another idea: We can create sub templates (and custom logic) for build-plugins, we render it and then we pass it to main pom. The main pom cycles through various possible extensions points and renders. I can work on it if you prefeer. In this way we can leave user choice to user shade plugin to create fat jar or vertx maven plugin etc.

slinkydeveloper commented 5 years ago

Wait but using web app codegens like create-react-app could break the js multi runtime compatibility browser/nodejs?

pmlopes commented 5 years ago

I was thinking something simpler, like just copy the examples. For example copy the web examples src/main/java and each package which is a demo becomes a template...