-
Notifications
You must be signed in to change notification settings - Fork 22
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
No embedded container found when micronaut-runtime added transitively #452
Comments
it just means there's no http server or similar present in the micronaut application. it's not an error. |
@yawkat It works all well when I add micronaut-runtime dependency to my pom.xml directly. Not working when I get micronaut comes from a different dependency as follows. Is there a way to tell micronaut where to load the classes, like a package path ? Beause it clearly does not like when micronaut maven dependency comes transitively. project-y pom.xml project-x pom.xml
And inside this project-x I do mvn mn:run. And it complains no container. |
@alvarosanchez think this might be related to maven? i would think the classpath for both setups would be basically the same. |
@yawkat found something else also related. Added direct dependency so I can start micronaut for the moment.
I think for same reason, things in a different project/dependency, it does not like it. Even singletons. Is there any set of dependencies that micronaut does not like other projects to bring ? If so then I can try excluding all those from external dependency to see i f it work. |
@subash89 the setup you are trying is not really supported. The Micronaut Maven Plugin has only been tested when added to Micronaut applications. That said, if you share a reproducible example, I can take a look |
@alvarosanchez Thanks for the response. I am preparing a project to recreate this easily. Meanwhile can you tell me whether we must use micronaut maven plugin ? Is there any other way like a creating a shaded jar and run it like java -jar? |
Running a shaded jar works, but again, this is only supported when using the Micronaut Maven Plugin |
Can you clarify a bit ? My understanding was, micronaut maven plugin does not need a shade plugin. Is there any example project I can refer to |
Added two projects as in the above scenario.
This will throw that error No bean of type [my.micronaut.core.ServiceX] exists. |
When further troubleshooting, since project-y is a regular java module, it won't do anything at compile time like a micronaut project like project-x do. So I tried to add micronaut dependencies and annotation processor to project-y as well. Related to this issue,
|
@alvarosanchez @yawkat is there a way to define via compiler plugin, to say use only these packages at compile time to avoid "Multiple possible bean candidates found" . |
Turns out micronaut-parent pom is a must to compile a micronaut project, and then only it create those META-INF bean references in the built jar. So in order to achieve original scenario, I tried adding micronaut parent pom and annotation processors to a existing project that has bunch of Java code, libraries like jersey, database dependencies etc. I am not sure what the parent pom plugins does, but I see very weird behaviors, like compilation fails on complaining some totally irrelevant Classes in regular "cannot find symbol" style errors. The moment I take out micronaut-parent, the project compiles fine. The reason I mentioned above example is, have we proved that we can compile any arbitrary java-maven project via micronaut compiler plugin ? |
FYI alvaro is currently on vacation. It may take a while for him to respond. |
@subash89 I yet need to find some time to check your example, but to shed some light:
|
@alvarosanchez thanks for the response. Yes as you said it;s the plugins that comes from parent and possibly some dependencies. Please let us know when you able to try it out. I tried many options I could think of to isolate this. |
mn-jaxrs.zip Here I attached a sample jaxrs example that using some thrird party code. In this example, mongodb.
If you look at the mvn dependency:tree on with and without parent pom of this project, there is a mismatch. Is the plugins trying to manipulate transitive dependencies/versions ? |
Is there anything in micronaut parent pom maven plugins that tries to pull latest versions of transitive dependencies ? |
Expected Behavior
I have a java maven library which has micronaut Application(main method) and pretty much everything. And I use that library as a maven dependency in a separate application project. When I try to run mvn mn:run
10:52:26.046 [main] INFO io.micronaut.runtime.Micronaut - No embedded container found. Running as CLI application
This only works if I directly add micronaut-runtime module in the current project pom. Even though micronaut-runtime comes transitively from other java library.
Why this is happening ?
Actual Behaviour
No response
Steps To Reproduce
No response
Environment Information
JDK 11
Micronaut 3.5.1
Example Application
No response
Version
3.5.1
The text was updated successfully, but these errors were encountered: