jhipster / generator-jhipster-micronaut

Micronaut blueprint for JHipster
Apache License 2.0
99 stars 29 forks source link

Update to Micronaut 3 #259

Closed JasonTypesCodes closed 1 year ago

JasonTypesCodes commented 3 years ago
Overview of the feature request

Micronaut 3 has been released!! It would be good to update this blueprint to support it

kevintanhongann commented 2 years ago

Any updates on this? Is it still on?

mraible commented 2 years ago

As you can see from the bug bounty I added four months ago, I'm very interested in this feature.

@atomfrede I have time this week to bring this blueprint up to date. Where would you suggest I start?

atomfrede commented 2 years ago

Good question. I think creating a plain micronaut app e.g. with oauth would be a good start to see what has changed and afterwards update the templates.

kevintanhongann commented 2 years ago

I have managed to upgrade a mHipster app from Micronaut 2 to Micronaut 3. The changes are mostly related to Authentication classes(I even got the auth tests working as well based on the changes), and package name changes for javax.inject to jakarta.inject. If you need more feedback from me, please do let me know.

mraible commented 2 years ago

@kevintanhongann Excellent! That's wonderful to hear that success is possible. I'll reply to this thread if/when I run into issues.

kevintanhongann commented 2 years ago

additional dependencies required:

implementation("io.micronaut.rxjava3:micronaut-rxjava3:2.3.0") implementation("io.micronaut.rxjava3:micronaut-rxjava3-http-client:2.3.0")

mraible commented 2 years ago

@kevintanhongann If you have the time to contribute to this issue, please do! Create a PR with the upgraded versions, add these dependencies, and let's see what happens!

Here's our contribution guide.

kevintanhongann commented 2 years ago

I'll try. So far I only got the main codebase of my project working. I got my test classes half done. Will need to spend some more time to identify what has changed then I'll get back to you ASAP.

On Mon, Aug 8, 2022 at 12:12 PM Matt Raible @.***> wrote:

@kevintanhongann https://github.com/kevintanhongann If you have the time to contribute to this issue, please do! Create a PR with the upgraded versions, add these dependencies, and let's see what happens!

Here's our contribution guide https://github.com/jhipster/generator-jhipster-micronaut/blob/main/CONTRIBUTING.md .

— Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster-micronaut/issues/259#issuecomment-1207642789, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACXY4JA43WLVIVTL6NC4OLVYCCL3ANCNFSM5EUHXEHA . You are receiving this because you were mentioned.Message ID: @.***>

-- Kevin H.A Tan

Technologist in Web & Mobile

https://linktr.ee/kevinhatan https://linktr.ee/kevinhatan

atomfrede commented 2 years ago

That's great news! Let's see how far we can get.

kevintanhongann commented 2 years ago

@atomfrede please have a look at what I did for an openid example. https://github.com/kevintanhongann/mhipster-openid-example, and it seems to me that my own project(in which it used JWT auth) has the same issue in the end for ./gradlew test

https://pastebin.com/6q96N65e

I think this is the last piece of the puzzle that needs to be solved before I can conclude the changes that I need to make to the generator.

Update: https://pastebin.com/c8NAu6pG

Update: Okay never mind. I was dumb. testCorsFilterOnApiPath() on the CorsTest was meant to fail, and fixed the application-test.yml by setting up a specific server port instead of a random one for the micronaut server.

kevintanhongann commented 2 years ago

I'm close. One last(hopefully) question. Where is the serverPort variable (where the root file is supposed to be located)? I believe the variable was supposed to register in the yml files being application-dev.yml and my application-test.yml but it didn't.

I think that is the last piece that I need to do to finalize my commit so that you guys can review my changes.

mraible commented 2 years ago

Where is the serverPort variable (where the root file is supposed to be located)?

For Spring Boot we, define it in both application-dev.yml and application-prod.yml:

It's not used in any test files. https://github.com/jhipster/generator-jhipster/tree/main/generators/server/templates/sql/common/src/test/resources/config

kevintanhongann commented 2 years ago

Here are my findings,

Normally most constants are trickling down from constant.cjs file to the sub files. IMG_20220809_114347

except for frontendAppName, packageName, serverPort and baseName. I assume they're obtained from the prompt?

Then that could mean one thing - I should code a logic to check whether the serverPort exists from the prompt. If not, I should write a default 8080 into the yml files.

mraible commented 2 years ago

I don't think you need to worry about serverPort. It defaults to 8080 and is mostly there for microservices, so we can change the ports when generating a microservice apps (to avoid port conflicts). I don't think this blueprint supports microservice architectures, yet.

atomfrede commented 2 years ago

Exactly. No Microservice Support yet. Nice picture👍

kevintanhongann commented 2 years ago

PR submitted https://github.com/jhipster/generator-jhipster-micronaut/pull/267

kevintanhongann commented 2 years ago

I'm close. One last(hopefully) question. Where is the serverPort variable? I believe the variable was supposed to register in the yml files being application-dev.yml and my application-test.yml but it didn't.

I think that is the last piece that I need to do to finalize my commit so that you guys can review my changes.

On Mon, Aug 8, 2022, 12:14 PM Frederik Hahne @.***> wrote:

That's great news! Let's see how far we can get.

— Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster-micronaut/issues/259#issuecomment-1207644630, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACXY4NK2NILYY55TIAQQATVYCCT3ANCNFSM5EUHXEHA . You are receiving this because you were mentioned.Message ID: @.***>

atomfrede commented 2 years ago

What do you mean by "where"? Where it is defined? It should come from the main generator and you can use it in templates via <%= serverPort %> I think (need to check if it has been renamed or so, but I don't think so).

atomfrede commented 2 years ago

@kevintanhongann By the way did you try https://docs.openrewrite.org/reference/recipes/java/micronaut/micronaut2to3migration on a generated project?

kevintanhongann commented 1 year ago

@atomfrede yet to try it. But I will see what I can test out soon.

kevintanhongann commented 1 year ago

@mraible so technically the PR has been merged. I suppose we can close this issue? And what else do I need to do from my end on the OpenCollective side?

mraible commented 1 year ago

@kevintanhongann Yes. We'll leave it open until you've been paid for your contribution.

mraible commented 1 year ago

@DanielFran or @pascalgrimaud should be able to help you get paid. I think part of the process involves you adding a link to your invoice to this issue.

kevintanhongann commented 1 year ago

I've done the filing already. @mraible pending approval.

kevintanhongann commented 1 year ago

https://opencollective.com/generator-jhipster/expenses/156012

pascalgrimaud commented 1 year ago

@kevintanhongann : approved, thanks for your work