I've spent some time trying to understand how to assemble EJB3s into EAR applications, reading the (very scarce...) plugin documentation and searching in the mailing archive, but I still don't get it. My understanding is that the first EAR POM should work, but it doesn't (I've stripped it to the bones -.no client, no WAR, no main POM project, no JUnit tests). The two troublesome sections are prefixed with asterisks:
EAR project pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.abeldrm.dbtest</groupId> <artifactId>dbtest-ear</artifactId> <packaging>ear</packaging> <version>1.0-SNAPSHOT</version> <name>DB Test EAR</name> <url>http://maven.apache.org</url> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <configuration> <version>5</version> * <modules> * <ejb3Module> * <groupId>com.abeldrm.dbtest</groupId> * <artifactId>dbtest-ejb</artifactId> * <bundleFileName>dbtest-ejb.ejb3</bundleFileName> * </ejb3Module> * </modules> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>com.abeldrm.dbtest</groupId> <artifactId>dbtest-ejb</artifactId> <version>1.0-SNAPSHOT</version> * <type>ejb3</type> <scope>compile</scope> </dependency> </dependencies> </project> EJB3 project pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.abeldrm.dbtest</groupId> <artifactId>dbtest-ejb</artifactId> <packaging>ejb</packaging> <version>1.0-SNAPSHOT</version> <name>DB Test EJB</name> <url>http://maven.apache.org</url> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ejb-plugin</artifactId> <configuration> <ejbVersion>3.0</ejbVersion> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>javaee</groupId> <artifactId>javaee-api</artifactId> <version>5</version> <scope>provided</scope> </dependency> </dependencies> </project> Whatever I do with the <modules> section of the plugin configuration, Maven complains about missing artifact 'com.abeldrm.dbtest:dbtest-ejb:ejb3:1.0-SNAPSHOT'. The only 'solution' I have found to this problem, is to change the dependency <type>ejb3</type> to <type>ejb</type>. But then Maven complains that 'Artifact[com.abeldrm.dbtest:dbtest-ejb:ejb3] is not a dependency of the project'. Finally, if I remove the <modules> section altogether (or alternatively, rename <ejb3Module> to <ejbModule> and remove the <bundleFileName> section), it seems to work - at least it deploys on the appserver... So, what did I do wrong in the first place? Or, if my final attempt is the correct one (staying away from both <type>ejb3</type> and <ejb3Module>) - what's the point of <type>ejb3</type> and <ejb3Module>?
