For reasons that I won't go into, I need to build the following structure:
EAR
|
|-- Uber-JAR
|
|-- WAR
I can build the uber JAR with the Maven Assembly plugin, but when I try to include it in the EAR (built with the Maven EAR plugin) it includes a normal JAR version, which has no sources (because I'm using the uber JAR to pull all the sources in the project together).
How can I get the uber JAR included in the EAR?
This is one way to fix it. If there's a better way I'd like to know it :)
Just include:
<earSourceDirectory>${basedir}</earSourceDirectory>
<earSourceIncludes>/path/to/jar.jar</earSourceIncludes>
in the EAR plugin configuration.
EDIT: Seems I spoke too soon. In the project's parent pom I have all the modules listed to build, with the uber JAR above the EAR module (as the last two modules).
It won't build the whole project:
'Artifact <ARTIFACT> (included by module) does not have an artifact with a file'
EDIT (again):
Final Answer
So, finally, in the configuration for the Maven Assembly plugin, I have:
<configuration>
...
<finalName>myjarname</finalName>
</configuration>
This creates a JAR file called simply 'myjarname.jar'.
In the Maven EAR plugin configuration, I use the following structure:
<configuration>
...
<modules>
...
<ejbModule>
<groupId>com.mygroup</groupId>
<artifactId>myartifact</artifactId>
<bundleFileName>myjarname.jar</bundleFileName>
</ejbModule>
</modules>
</configuration>
This grabs the specific jar and puts it in the EAR. Voila!