Skip to content

Quarkus dev mode is not working with a certain type of folder tree due to dependency injection #32690

@jakwarrior

Description

@jakwarrior

Describe the bug

I found a very odd bug. I have a multimodule project and I use maven. I have 2 modules, A and B, with B depending on A. A contains a @ApplicationScoped annotated bean.

If I use this tree, everything is fine:

- pom.xml
- A folder
   - pom.xml
- B folder
  - pom.xml

But if I use this tree, the quarkus dev mode is not working:

- parent folder
   - pom.xml
- A folder
   - pom.xml
- B folder
  - pom.xml

There is a UnsatisfiedResolutionException, the bean from A is not found. But the project is still working if I use the command "java -jar quarkus-run.jar, it's only in dev mode.

Expected behavior

The dev mode should be working for every kind of tree.

Actual behavior

No response

How to Reproduce?

I created a small project to reproduce the problem:
https://github.com/jakwarrior/quarkus-2-multi-module-project-quickstart

The main branch is working. You can use mvn quarkus:dev in the root of the project and everything is fine.
You can see the problem with the branch named "not_working". Go to the "quickstart-parent" folder and do mvn quarkus:dev. You will see this stacktrace:

2023-04-17 16:26:24,033 WARN  [io.qua.arc.pro.BeanArchives] (build-39) Failed to index com.github.bgizdov.multimodule.entities.User: Class does not exist in ClassLoader QuarkusClassLoader:Deployment Class Loader: DEV@53fb3dab
2023-04-17 16:26:24,043 WARN  [io.sma.ope.run.scanner] (build-39) SROAP04005: Could not find schema class in index: com.github.bgizdov.multimodule.entities.User
2023-04-17 16:26:24,076 INFO  [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2023-04-17 16:26:24,564 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.github.bgizdov.multimodule.service.TestService and qualifiers [@Default]
        - java member: com.github.bgizdov.multimodule.resources.UserResource#injectService
        - declared on CLASS bean [types=[com.github.bgizdov.multimodule.resources.UserResource, java.lang.Object], qualifiers=[@Default, @Any], target=com.github.bgizdov.multimodule.resources.UserResource]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1223)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:288)
        at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:148)
        at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:526)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

The "quickstart-core" module contains a simple bean that cannot be injected.

@ApplicationScoped
@Getter
public class TestService {
    private final String test = "Hello inject !";
}

Output of uname -a or ver

Windows 11

Output of java -version

openjdk version "11.0.15"

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.16.6

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

maven 3.8.5

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions