Indeed, the maven-ejb-plugin doesn't provide any parameter to change the location of the deployment descriptor which is expected to be available at META-INF/ejb-jar.xml
(the location is hard coded in the EjbMojo) or the build will fail at packaging time when building EJB 2.X (which makes sense).
So, one way to achieve your goal would be to use the maven-antrun-plugin before the packaging phase to copy the content of directoryA
(assuming directoryA
was in a resources directory like src/main/resources
and has been copied to target/classes
) to the expected location (i.e. the root of target/classes
) and do some clean up, something like this:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<configuration>
<tasks>
<copy todir="${project.build.outputDirectory}">
<fileset dir="${project.build.outputDirectory}/directoryA"/>
</copy>
<delete dir="${project.build.outputDirectory}/directoryA"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
I don't find this very clean but it works.