Specifying ejb client as dependencies in Maven

I have 2 EJB A and B (in different jar files), EJB A calls one EJB B method.

From the following Maven docs, I use generateClient to create an ejb client and use the ejb-client dependency to get the jar. http://maven.apache.org/plugins/maven-ejb-plugin/examples/generating-ejb-client.html http://people.apache.org/~aramirez/maven-ejb-plugin/examples/ejb- client-dependency.html

It’s good to use Maven to create, deploy, and run. The problem is that although Project A needs only the EJB B interface class, Maven includes all the EJB B dependency libraries in the EJB A dependency. As a result, EJB A will have many unnecessary jar files. Is there any solution to fix it?

+4
source share
2 answers

I found another solution, the Maven dependency has an exclusive function, and I use it to delete some jar files.

<dependencies> <dependency> <groupId>com.example</groupId> <artifactId>ejb-project</artifactId> <version>1.0-SNAPSHOT</version> <type>ejb-client</type> <exclusions> <exclusion> <groupId>sample.ProjectD</groupId> <artifactId>Project-D</artifactId> </exclusion> </exclusions> </dependency> </dependencies> 
+2
source

The only way is to move the EJB B interface to a separate jar. Then use it as a dependency in projects and modules EJB A and B.

0
source

Source: https://habr.com/ru/post/1380148/


All Articles