Closed mzellho closed 5 months ago
/cc @mkouba (qute)
@aloubyansky Is it expected that MultiRootPathTree.accept(String, Consumer<PathVisit>)
does not accept all roots; src/main/resources/templates
and src/test/resources/templates
in this particular case.
It seems to be a regression introduced in https://github.com/quarkusio/quarkus/pull/40158/commits/6014d5119451e6dfa9e22bd7b19b9ebeabf2477d.
We should definitely add a test with templates in the src/test/resources/templates
directory.
Ah, I see, it should be considered a bug. If the path was a file, I think we would pick the first found (like it is right now) but if it's a directory, so the content should be merged I guess.
but if it's a directory, so the content should be merged I guess.
Yes, I would expect this behavior.
Would you care to send a fix?
Yes, i'll look into it
@mkouba i think https://github.com/quarkusio/quarkus/pull/40400 should fix it. Multi rooted path trees are walked over entirely. It's just the path object isn't a good to calculate the relative for all found template roots in this case.
So the accept
call would be just a check whether a PathTree contains a template root and should be walked over to collect all the templates.
I'll add some other API to PathTree to make it more convenient for these use-cases.
The reproducer works with the linked PR
In the meantime, Stuart also opened this PR that adds PathTree.acceptAll(String relativePath, Consumer<PathVisit> func)
, which is kind of relevant to the original issue but not necessary for the PR I linked as the fix.
Describe the bug
As soon as there is a directory
src/test/resources/templates
, Qute Templates can no longer be found when executing tests, resulting in aNo template matching the path foo/bar could be found for: org.acme.FooTemplates.bar
.For more discussion, see https://github.com/quarkusio/quarkus/pull/40158
Expected behavior
The existence of a
src/test/resources/templates
should not break the resolution of the templates.Actual behavior
No template matching the path foo/bar could be found for: org.acme.FooTemplates.bar
when running tests.How to Reproduce?
Reproducer project: https://github.com/mzellho/quarkus-quickstarts/tree/reproducer/40158
mvn test
onqute-quickstart
--> failsrc/test/resources/templates
--> successOutput of
uname -a
orver
Linux xxxxx 6.5.0-28-generic #29-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 28 23:46:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "21.0.3" 2024-04-16 LTS OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)
Quarkus version or git rev
3.9.5
Build tool (ie. output of
mvnw --version
orgradlew --version
)Running
/home/xxxxx/work/2/quarkus-quickstarts/mvnw
... Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63) Maven home: /home/xxxxx/.m2/wrapper/dists/apache-maven-3.8.6-bin/67568434/apache-maven-3.8.6 Java version: 21.0.3, vendor: Eclipse Adoptium, runtime: /home/xxxxx/.sdkman/candidates/java/21.0.3-tem Default locale: de_DE, platform encoding: UTF-8 OS name: "linux", version: "6.5.0-28-generic", arch: "amd64", family: "unix"Additional information
No response