-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Describe the bug
In a project I have configured the following profile that overrides the default project build directory with target-api:
<profile>
<id>api</id>
<build>
<directory>target-api</directory>
</build>
</profile>With that profile, I have no problem compiling / packaging the app (mvn clean package -Papi), the artifacts are found under target-api instead of target
However when launching the quarkus dev mode (mvn clean quarkus:dev -Papi), it failed with an error indicating that the dev mojo still looks for compiled classes under target
Hot reloadable dependency com.example:quarkus_playground:1.0-SNAPSHOT has not been compiled yet (the classes directory /quarkus-project/target/classes does not exist)
Expected behavior
The quarkus:dev mojo should launch normally
Actual behavior
The following error is thrown:
Hot reloadable dependency com.example:quarkus_playground:1.0-SNAPSHOT has not been compiled yet (the classes directory /quarkus-project/target/classes does not exist)
How to Reproduce?
Steps to reproduce:
- Init an empty project with the latest version of quarkus (2.16.1.Final as the time of writing)
- Add a profile that overrides the build directory (as in the bug description)
- Run
quarkus:devwith the profile, e.g.mvn quarkus:dev -P<profile>
Output of uname -a or ver
No response
Output of java -version
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.16.1.FINAL
Build tool (ie. output of mvnw --version or gradlew --version)
Maven 3.8.4
Additional information
Here is the quick fix I'm applying to get rid of the issue (I'm not sure if it is the right place to patch but it works :D)
Add this line after line 74 of the file below
mp.getOriginalModel().getBuild().setDirectory(mp.getModel().getBuild().getDirectory());
quarkus/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java
Lines 67 to 78 in e48aace
| static Map<Path, Model> getProjectMap(MavenSession session) { | |
| final List<MavenProject> allProjects = session.getAllProjects(); | |
| if (allProjects == null) { | |
| return Map.of(); | |
| } | |
| final Map<Path, Model> projectModels = new HashMap<>(allProjects.size()); | |
| for (MavenProject mp : allProjects) { | |
| mp.getOriginalModel().setPomFile(mp.getFile()); | |
| projectModels.put(mp.getBasedir().toPath(), mp.getOriginalModel()); | |
| } | |
| return projectModels; | |
| } |