Dependency in Java – Maven: what impact does EJB type have?
If you declare dependencies in maven, you can add types, such as war, jar, EJB
I know that compiling a project of type EJB is different from compiling a project of type jar because it triggers a different life cycle
But what is the difference between declarative dependencies?
Maven dependency type EJB vs jar seems to ask the same question, but the accepted answer seems strange to me I doubt whether types in dependencies can trigger lifecycles In fact, I want the type EJB to be exactly the same as the type jar Can anyone explain?
Solution
You're not the only one who doubts
When you declare dependencies using EJB types, you will benefit from some tools provided by Maven related to EJB:
>Can be in application Add EJB declaration to XML Starting with Java EE 5, you no longer need it. > Check that the dependencies are EJBs instead of simple jars. > There may be other small things
If you declare dependencies using jar types, you do not have these capabilities
As you've noticed, it hasn't changed in many ways, but anyway, it's the same jar for dependencies in both cases
You do not refer to EJB client type, but it is usually more interesting because, contrary to the dependency of jar or EJB type using the same jar, when you declare EJB client type in dependency, you rely on a different jar, because the classic jar of this jar should only contain API classes to call EJB Of course, if we want the EJB version EJB client, we must specify it in the EJB generation artifact