通常,胖客户端应用程序只需要 EJB 项目的存根和实用程序类。EJB 插件能够生成 EJB JAR 供客户端使用。
要生成 ejb-client JAR,您需要在插件的配置中将generateClient设置为true :
[...]
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.4</version>
<configuration>
<!-- this is false by default -->
<generateClient>true</generateClient>
</configuration>
</plugin>
</plugins>
[...]
</build>
[...]ejb-client 归档的内容也可以使用包含和排除进行定制。
要对此进行自定义,请使用clientExcludes和clientIncludes元素:
[...]
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.4</version>
<configuration>
<clientIncludes>
<!-- this will include all files and directories under com/foo/bar -->
<clientInclude>com/foo/bar/**</clientInclude>
<!-- this will include all files and directories under com/foo/acme -->
<clientInclude>com/foo/acme/**</clientInclude>
<!-- this will include all files under com/example -->
<clientInclude>com/example/*</clientInclude>
</clientIncludes>
<clientExcludes>
<!-- this will exclude all files under com/example -->
<clientExclude>com/example/*</clientExclude>
<!-- this will exclude all files and directories with the name
sparrow under com/jack -->
<clientExclude>com/jack/**/sparrow</clientExclude>
</clientExcludes>
</configuration>
</plugin>
</plugins>
[...]
</build>
[...]注意:混合排除和包含时要小心,排除将比包含具有更高的优先级。