You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dobri Kitipov <kd...@googlemail.com> on 2008/05/21 13:04:56 UTC

Assembly plugin with several descriptors

Hi all,
currently I am trying to execute an assembly that makes use of two
descriptors. I want to package a given artifact as a ZIP (i.e. my product
eclipse plugin) and then include it in an artifact (i.e. my product
distribution) that has a DIR and ZIP format set. The problem is that in the
first descriptor (D1) have ZIP format, but I have the same format into the
second descriptor (D2). As these two descriptors are specified to one given
assembly plugin they share one common <finalName> specified:
<plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2-beta-2</version>
                <configuration>
                    <finalName>myproduct-${myproduct.version}</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptors>
                        <descriptor>tools/eclipse/D1.xml</descriptor>
                        <descriptor>assembly/D2.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>

This causes a problem because when the first artifact (A1) is crearted it
has the name myproduct-${myproduct.version}.zip, then this artifact is
overridden by the second artifact (A2) created by D2 execution that need to
include the A1.
So, my question is is it possible to use different names for A1 and A1 when
their descriptors are executed toggether?


Additionally I can read into the assembly log the following note:
"NOTE: If multiple descriptors or descriptor-formats are provided for this
project, the value of this file will be non-deterministic!"

What does it mean? Does it mean that the order of the invocation/execution
of the descriptors is non-deterministic? or what?

Thank you in advance
Dobri

Re: Assembly plugin with several descriptors

Posted by John Casey <jd...@commonjava.org>.
This is a fairly involved use case, but I'd suggest taking a slightly 
different approach. First, split your plugin configuration into two 
<execution> sections, instead of one...one per assembly descriptor. This 
should allow you to set the <finalName> for your distro ZIP, but not the 
plugin ZIP. Next, make sure the plugin assembly is built first, maybe by 
specifying it as the first <execution/> of the assembly plugin in your 
POM (this should work), or by attaching it via <phase>test</phase> (if 
it doesn't work).

So, when you build your plugin zip, it'll have a filename other than 
what you want in your distro...like maybe myproduct-version-plugin.zip 
or something. You can actually put this under a different name inside 
your distro zip by adjusting the outputFileNameMapping (in 
<dependencySet/>) or destName (in <file/>). When your distro assembly 
descriptor executes, direct it to include the plugin's alternative 
filename instead of the one you specified in the finalName.

As for the warning you're seeing in the log files, I'd need a little 
more context from the log output to understand what's going on 
there...I'd probably have to go look back at the source code to see 
where it was coming from, if the logs didn't shed more light on it.

HTH,

-john


Dobri Kitipov wrote:
> Hi all,
> currently I am trying to execute an assembly that makes use of two
> descriptors. I want to package a given artifact as a ZIP (i.e. my product
> eclipse plugin) and then include it in an artifact (i.e. my product
> distribution) that has a DIR and ZIP format set. The problem is that in the
> first descriptor (D1) have ZIP format, but I have the same format into the
> second descriptor (D2). As these two descriptors are specified to one given
> assembly plugin they share one common <finalName> specified:
> <plugin>
>                 <artifactId>maven-assembly-plugin</artifactId>
>                 <version>2.2-beta-2</version>
>                 <configuration>
>                     <finalName>myproduct-${myproduct.version}</finalName>
>                     <appendAssemblyId>false</appendAssemblyId>
>                     <descriptors>
>                         <descriptor>tools/eclipse/D1.xml</descriptor>
>                         <descriptor>assembly/D2.xml</descriptor>
>                     </descriptors>
>                 </configuration>
>             </plugin>
>
> This causes a problem because when the first artifact (A1) is crearted it
> has the name myproduct-${myproduct.version}.zip, then this artifact is
> overridden by the second artifact (A2) created by D2 execution that need to
> include the A1.
> So, my question is is it possible to use different names for A1 and A1 when
> their descriptors are executed toggether?
>
>
> Additionally I can read into the assembly log the following note:
> "NOTE: If multiple descriptors or descriptor-formats are provided for this
> project, the value of this file will be non-deterministic!"
>
> What does it mean? Does it mean that the order of the invocation/execution
> of the descriptors is non-deterministic? or what?
>
> Thank you in advance
> Dobri
>
>   

-- 
John Casey
Developer, PMC Member - Apache Maven (http://maven.apache.org)
Blog: http://www.ejlife.net/blogs/buildchimp/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org