quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.72k stars 2.67k forks source link

Hot Reloading conflicts with Maven Flatten Plugin #39978

Closed kjq closed 6 months ago

kjq commented 6 months ago

Describe the bug

So, an odd issue, when running mvn quarkus:dev, the Maven Flatten plugin is involved, and I believe projects where the flatten is a direct plugin (inheriting from the main parent POM) - hot-reload does not seem to work.

The updated POMs from the flatten plugin look correct and the runnable service works fine just not hot-reload during development.

Without the flatten plugin the project will work.

Expected behavior

Hot-reload recognizes changes in the module where quarkus:dev was run and recognizes changes in other modules within the same parent.

Actual behavior

When the Flatten plugin is involved the project does not recognize changes in source files.

Without it or skipped it does work and in simpler single projects it works fine even with the flatten plugin (oddly, the pattern for the simpler projects is the flatten plugin is defined a level higher in another parent).

How to Reproduce?

  1. Unzip the project
  2. mvn install from the root
  3. cd quickstart-rest

Reproduce:

  1. mvn quarkus:dev
  2. Change the User class in quickstart-core, save it.
  3. Reload the running service (s) - note, no changes are recognized.

Working:

  1. mvn quarkus:dev -flatten.skip=true
  2. Change the User class in quickstart-core, save it.
  3. Reload the running service (s) - note, changes are recognized now.

Our work-around is a profile that applies that property only on the project where we see the problem.

quarkus-multi-module-project-quickstart.zip

Output of uname -a or ver

No response

Output of java -version

17

Quarkus version or git rev

3.9.2

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.9.5

Additional information

This could be a complete edge-case coupled with the combination of Maven friendly-versions and the Flatten plugin (which we need to deploy the version-friendly versions) but since it does work with simpler/single projects, even with the Flatten plugin involved, I though I would at least bring it up. Where is does not work is consistent across projects with the same setup.

quarkus-bot[bot] commented 6 months ago

/cc @quarkusio/devtools (maven)

aloubyansky commented 6 months ago

@kjq with https://github.com/quarkusio/quarkus/pull/39982 the flatten plugin will be skipped by default if dev mode is launched with mvn quarkus:dev. However, if dev mode is launched with mvn compile quarkus:dev then the flatten plugin will be executed by Maven, it's out of Quarkus scope in this case.

Also with that change you'll be able to configure other plugins that should be skipped by adding skipPlugins configuration element to the Quarkus plugin config. But I guess that won't be necessary in most cases.

kjq commented 6 months ago

Thank you so much! It wasnt a super huge deal but this will make things smoother. Maven friendly versions and the flatten plugin are the bane of my life.