Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternate pom.xml ignored in Quarkus Dev mode and Tests if not specified with an absolute path #18981

Closed
garyhodgson opened this issue Jul 24, 2021 · 3 comments · Fixed by #18985
Labels
area/devmode kind/bug Something isn't working
Milestone

Comments

@garyhodgson
Copy link

Describe the bug

Whilst investigating #18980 I encountered the problem that tests and dev mode do not seem to use the alternate pom when using the maven -f flag.

I attempted to use the flattened pom file generated by the flatten-maven-plugin, but this resulted in the same exceptions.

After further investigation I found out that the alternate pom seems to be ignored if the original pom.xml remains in the base directory. Temporarily deleting the pom.xml results in the tests passing and the app successfully starting in dev mode.

As I was writing up this issue I noticed in BootstrapMavenContext.getPomForDirOrNull it expects the alternate pom.xml to have an absolute path. I then tested and can confirm that an absolute path works even with the original pom.xml still in the directory.

Expected behavior

quarkus dev mode and tests to work when specifying an alternate pom using a relative path, e.g. mvn -f .flattened-pom.xml test rather than having to give an absolute path.

Actual behavior

The same exceptions occur as when running the commands against the regular pom.xml.

(Please note that the actual exceptions here are not the focus of this ticket, rather they indicate that the wrong pom.xml is being used.)

How to Reproduce?

Reproducer: https://github.com/garyhodgson/quarkusdev_profiledep_reproducer

Steps:

Test:

  • git clone https://github.com/garyhodgson/quarkusdev_profiledep_reproducer.git
  • cd quarkusdev_profiledep_reproducer
  • mvn clean process-resources
  • cd getting-started
  • mvn -f .flattened-pom.xml test
    • Exception occurs
  • mvn -f $(PWD)/.flattened-pom.xml test
    • Tests succeed
  • rm pom.xml
  • mvn -f .flattened-pom.xml test
    • Tests succeed

Dev mode:

  • git clone https://github.com/garyhodgson/quarkusdev_profiledep_reproducer.git
  • cd quarkusdev_profiledep_reproducer
  • mvn clean process-resources
  • cd getting-started
  • mvn -f .flattened-pom.xml quarkus:dev
    • Exception occurs
  • mvn -f $(PWD)/.flattened-pom.xml quarkus:dev
    • App starts in dev mode.
  • rm pom.xml
  • mvn -f .flattened-pom.xml quarkus:dev
    • App starts in dev mode.

Output of uname -a or ver

CYGWIN_NT-10.0 garyhodgson-PC 3.1.7(0.340/5/3) 2020-08-22 17:48 x86_64 Cygwin

Output of java -version

openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

GraalVM version (if different from Java)

N/A

Quarkus version or git rev

2.0.3.Final

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

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)

Additional information

  • The IT io.quarkus.maven.it.DevMojoIT#testAlternatePom from Devmode: support launching devmode with an alternate pom #9919 only covers the case when there is an alternative pom and no original pom.xml. When I added a pom.xml alongside the alternative-pom.xml, and manually ran mvn -f alternative-pom.xml quarkus:dev in the test project folder it appears to instead try and use the pom.xml
@garyhodgson garyhodgson added the kind/bug Something isn't working label Jul 24, 2021
@geoand
Copy link
Contributor

geoand commented Jul 26, 2021

cc @aloubyansky

@aloubyansky
Copy link
Member

Thanks for the report, #18985 will fix it.

@garyhodgson
Copy link
Author

@aloubyansky Many thanks for the very quick response! I'll test as soon as it becomes available.

@quarkus-bot quarkus-bot bot added this to the 2.2 - main milestone Jul 28, 2021
@gsmet gsmet modified the milestones: 2.2 - main, 2.1.1.Final Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devmode kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants