You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Lamarre, Michael" <Mi...@cable.comcast.com> on 2008/04/22 23:43:23 UTC

Problem using maven-assembly-plugin with multiple projects

Hello.  I am trying to build a project that has two child modules layed
out like so:

 

myproject/pom.xml

myproject/common/pom.xml

myproject/engines/pom.xml

 

The engines module is dependent upon the common module.  For the engines
project, I have the maven-jar-plugin configured to insert the classpath
into the manifest, and I am also using the maven-assembly-plugin to
bundle up the engines JAR file as well as all of its dependencies into a
single ZIP archive.

 

If I go into the eninges directory and do 'mvn install', the Class-Path
in the manifest that is built for myprojectengines.jar contains an entry
for myprojectcommon-<version>.jar.  That's fine, because that's what the
maven-assembly-plugin puts in my ZIP file.  If I go up one directory and
do 'mvn install' to build both the myprojectcommon and myprojectengines
modules at once, the Class-Path in the manifest of myprojectengines.jar
contains an entry for myprojectcommon.jar.  Note that the version is
missing.  The maven-assembly-plugin still gets
myprojectcommon-<version>.jar from my local repository and leaves its
name alone, so I now have a mismatch between the manifest and the JAR
that was actually put into my ZIP file.

 

Why does the Class-Path entry come out different depending on where I do
my build from?  It seems to me the Class-Path should always be built
using the proper JAR file names as one would expect to find them in the
Maven repository, not the name of the JAR that is generated in
myproject/common/target.  I have dug around the documentation, but I
cannot find a way to control the naming of entries in the manifest,
short of building my own manifest file externally and forcing it into
the JAR via the <manifestFile> element.

 

Can anyone shed some light on this for me and maybe suggest an
alternative?  I know I can make maven-assembly-plugin rename the JARs it
grabs by using <outputFileNameMapping>, but all this does is flip the
situation so that there is a mismatch when I build from the engines
directory instead of when I build from the myproject directory.  I don't
get why the name of the myprojectcommon.jar file in the manifest is
different under different circumstances.

 

--M