On Sat, 5 Nov 2005, Christian Schulte wrote:

> Hi,
>
> Could it be that the assembly plugin does not support multi-module
> projects correctly ?
> I have the following project structure:
>
> Root
> |--Module1
> |--Module2
> |--Module3
>
> So somewhere in Root's pom.xml I have
>
> <modules>
>   <module>Module1</module>
>   <module>Module2</module>
>   <module>Module3</module>
> </modules>
>
> I now want the assembly plugin to build a jar file of all three ModuleX
> jar files and it does not work. When I do mvn assembly:assembly it does
> not use the three modules. If I put
>
> <dependencies>
>   <dependency>
>      <groupId>groupId</groupId>
>      <artifactId>Module1</artifactId>
>   </dependcy>
>   <dependency>
>      <groupId>groupId</groupId>
>      <artifactId>Module2</artifactId>
>   </dependcy>
>   <dependency>
>      <groupId>groupId</groupId>
>      <artifactId>Module3</artifactId>
>   </dependcy>
> </dependencies>

That's the fix allright.

The assembly plugin just works on the current project, it does recurse but
it will create an assembly for all child projects too if they have the
assembly plugin configured.

>
> into Root's pom.xml Maven complains about cyclic dependencies. So if the
> <modules>...</modules> section already defines the modules as

No, they don't automatically define them as dependencies! You really need
a dependencies section.

> dependencies why does the assembly plugin not see them ? If this section

See above - they're not dependencies.

> would not introduce a dependency to the modules why should maven
> complain about the cyclic dependencies ? What is the correct way to use
> the assembly plugin then ?

The cyclic dependencies are because of another reason. My guess is that
you have a <dependency> in ModuleX on the root pom. You should remove that
dependency and just use the <parent> tag - you'll inherit whatever is
defined in the root pom.

> I looked at the source to see how things are intended to work. If I make
> the following change:
>
> [EMAIL 
> PROTECTED]:~/maven2-cvs/maven-site/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly$
> svn diff
> Index: AbstractUnpackingMojo.java
> ===================================================================
> --- AbstractUnpackingMojo.java  (Revision 330942)
> +++ AbstractUnpackingMojo.java  (Arbeitskopie)
> @@ -130,7 +130,7 @@
>
>                  String key = artifact.getGroupId() + ":" +
> artifact.getArtifactId() + ":" + artifact.getVersion();
>
> -                if ( !reactorArtifacts.containsKey( key ) &&
> !dependencies.containsKey( key ) )
> +                if ( !dependencies.containsKey( key ) )
>                  {
>                      dependencies.put( key, artifact );
>                  }

That code specified that if a <dependency> tag in the assembly descriptor
was not a reactor project ANd not a dependency, then make it a dependency.

Your patch looks sane to me - something being a reactor project doesn't
implicate that it's a dependency. But I would have to look at more context
code to be sure why this was done this way.

> mvn assembly:assembly starts aggregating the contents of the jar files
> of the modules. There is just one thing which then still does not work
> and that are the different manifest files are lost and I get a default
> manifest in the assembled jar file. I definetly need help with this.

Which manifest file should be used? You can't merge them. You'll have to
specify a new manifest file for the aggregated jar to use.


-- Kenney

> --
> Christian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to