You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ashley Williams <ag...@mac.com> on 2005/09/20 12:16:31 UTC

[m2] assembly plugin

Does anyone know how to use assembly:assembly, in particular what the  
descriptor is supposed to be? I did hardcode it as a path to my pom  
from within my pom (that seems wrong) which made the plugin run  
without errors, but I didn't see any output file.

Thanks
-AW

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


Re: [m2] assembly plugin

Posted by Ashley Williams <ag...@mac.com>.
Johnny, thanks for your response - I did manage to get it to work  
after all.
Now if only I could add the task to my pom I'd be happy, but it seems  
I'm not allowed!

AW

On 21 Sep 2005, at 00:49, Johnny R. Ruiz wrote:

> Ashley Williams wrote:
>
>
>> Does anyone know how to use assembly:assembly, in particular what  
>> the  descriptor is supposed to be? I did hardcode it as a path to  
>> my pom  from within my pom (that seems wrong) which made the  
>> plugin run  without errors, but I didn't see any output file.
>>
>> Thanks
>> -AW
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> Ashley,
>
> You could create your own Descriptor file.   Here is the example of  
> descriptor that was used when  you run "m2 assembly:assembly - 
> DdescriptorId=jar-with-dependencies".
>
> <assembly>
>  <id>jar-with-dependencies</id>
>  <formats>
>    <format>jar</format>
>  </formats>
>  <includeBaseDirectory>false</includeBaseDirectory>
>  <fileSets>
>    <fileSet>
>      <directory>target/classes</directory>
>      <outputDirectory>/</outputDirectory>
>    </fileSet>
>  </fileSets>
>  <dependencySets>
>    <dependencySet>
>      <outputDirectory>/</outputDirectory>
>      <unpack>true</unpack>
>      <scope>runtime</scope>
>    </dependencySet>
>  </dependencySets>
> </assembly>
>
> You could create your own descriptor to get what you want.  To use  
> your customized descriptor file, use "m2 assembly:assembly - 
> Ddescriptor=path/to/your/descriptor.xml".
>
> Hope this helps,
> --- Johnny :)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


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


Re: [m2] assembly plugin

Posted by "Johnny R. Ruiz " <jr...@exist.com>.
Ashley Williams wrote:

> Does anyone know how to use assembly:assembly, in particular what the  
> descriptor is supposed to be? I did hardcode it as a path to my pom  
> from within my pom (that seems wrong) which made the plugin run  
> without errors, but I didn't see any output file.
>
> Thanks
> -AW
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
Ashley,

You could create your own Descriptor file.   Here is the example of 
descriptor that was used when  you run "m2 assembly:assembly 
-DdescriptorId=jar-with-dependencies".

<assembly>
  <id>jar-with-dependencies</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <fileSet>
      <directory>target/classes</directory>
      <outputDirectory>/</outputDirectory>
    </fileSet>
  </fileSets>
  <dependencySets>
    <dependencySet>
      <outputDirectory>/</outputDirectory>
      <unpack>true</unpack>
      <scope>runtime</scope>
    </dependencySet>
  </dependencySets>
</assembly>

You could create your own descriptor to get what you want.  To use your 
customized descriptor file, use "m2 assembly:assembly 
-Ddescriptor=path/to/your/descriptor.xml".

Hope this helps,
--- Johnny :)

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


Re: [m2] assembly plugin + a few instructions

Posted by Ashley Williams <ag...@mac.com>.
Ok, the name of the file may suggest that it would achieve my goals,  
but in practice it doesn't.
I did give it a go and it resulted in all my jar dependencies being  
unpacked -
definitely not what I want.

Looking at the xml the line which does this is:
       <unpack>true</unpack>

Additionally it causes a jar file to be generated whereas I want  
something like a tar. None of
the three assembly files suit me which is why I had to tailor my own

Thanks
AW

On 20 Sep 2005, at 20:21, Daniel Schömer wrote:

> Ashley Williams wrote:
>
>> I was expecting the jars from my dependencies section to be there.
>> [...]
>> Which resulted in a compressed file(s) containing my jar file and its
>> dependencies.
>> I was then able to uncompress it and launch with the java -jar  
>> command.
>>
>
> Well, you should have tried the descriptorId
> "jar-with-dependencies".  It seems to me that this would have
> created a jar that should fit your needs.
>
> Daniel Schömer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


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


Re: [m2] assembly plugin + a few instructions

Posted by Daniel Schömer <da...@gmx.net>.
Ashley Williams wrote:
> I was expecting the jars from my dependencies section to be there.
> [...]
> Which resulted in a compressed file(s) containing my jar file and its  
> dependencies.
> I was then able to uncompress it and launch with the java -jar command.

Well, you should have tried the descriptorId
"jar-with-dependencies".  It seems to me that this would have
created a jar that should fit your needs.

Daniel Schömer


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


Re: [m2] assembly plugin + a few instructions

Posted by Ashley Williams <ag...@mac.com>.
I was expecting the jars from my dependencies section to be there.
However I did manage to find an example of a descriptor file by  
greping in the maven source -
it's under maven-assembly-plugin/

For anyone who's interested
I'm actually trying to see if there is enough in Maven to allow me to  
cobble together an application,
including Class-path entries in manfest, and there is just about.  
Here's what I did:

I added the following to my pom so that my manifest would be  
generated correctly and that
the assembly plugin would find my descriptor:

     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-assembly-plugin</artifactId>
         <configuration>
           <descriptor>app.xml</descriptor>
         </configuration>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <configuration>
           <archive>
             <manifest>
               <mainClass>com.example.mbeans.Main</mainClass>
               <addClasspath>true</addClasspath>
             </manifest>
           </archive>
         </configuration>
       </plugin>
     </plugins>

then I created the following descriptor app.xml:

<assembly>
   <id>bin</id>
   <formats>
     <format>tar.gz</format>
     <format>tar.bz2</format>
     <format>zip</format>
   </formats>
   <fileSets>
     <fileSet>
       <directory>target</directory>
       <outputDirectory></outputDirectory>
       <includes>
         <include>*.jar</include>
       </includes>
     </fileSet>
   </fileSets>
   <dependencySets>
     <dependencySet>
       <outputDirectory>/</outputDirectory>
       <scope>runtime</scope>
     </dependencySet>
   </dependencySets>
</assembly>

Which resulted in a compressed file(s) containing my jar file and its  
dependencies.
I was then able to uncompress it and launch with the java -jar command.

Cheers
AW

On 20 Sep 2005, at 16:21, Daniel Schömer wrote:


> Ashley Williams wrote:
>
>
>> On 20 Sep 2005, at 12:49, Daniel Schömer wrote:
>>
>>
>>> Ashley Williams wrote:
>>>
>>>
>>>> Does anyone know how to use assembly:assembly, in particular  
>>>> what the
>>>> descriptor is supposed to be? I did hardcode it as a path to my pom
>>>> from within my pom (that seems wrong) which made the plugin run
>>>> without errors, but I didn't see any output file.
>>>>
>>>>
>>>>
>>> I've successfully run assembly:assembly setting descriptorId to  
>>> one of
>>> the id in the provided assemblies ("bin", "src" or
>>> "jar-with-dependencies").
>>>
>>>
>>
>> Thanks that worked although I didn't find what I was hoping for in
>> the resulting zip file.
>>
>>
>
> Hm, I don't know what you expected in the resulting zip file, but
> the results I've gotten were as I've expected.
>
> The assemblies shipped with the assembly plugin are relatively
> simple xml files specifying file-sets of what to include.  Since
> you know ant (as you wrote in
> <C7...@mac.com>), you can probably
> adapt the assembly xml files to your needs.
>
> Regards,
> Daniel Schömer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>



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


Re: [m2] assembly plugin

Posted by Daniel Schömer <da...@gmx.net>.
Ashley Williams wrote:
> On 20 Sep 2005, at 12:49, Daniel Schömer wrote:
>> Ashley Williams wrote:
>>> Does anyone know how to use assembly:assembly, in particular what the
>>> descriptor is supposed to be? I did hardcode it as a path to my pom
>>> from within my pom (that seems wrong) which made the plugin run
>>> without errors, but I didn't see any output file.
>>>
>> I've successfully run assembly:assembly setting descriptorId to one of
>> the id in the provided assemblies ("bin", "src" or
>> "jar-with-dependencies").
>
> Thanks that worked although I didn't find what I was hoping for in  
> the resulting zip file.

Hm, I don't know what you expected in the resulting zip file, but
the results I've gotten were as I've expected.

The assemblies shipped with the assembly plugin are relatively
simple xml files specifying file-sets of what to include.  Since
you know ant (as you wrote in
<C7...@mac.com>), you can probably
adapt the assembly xml files to your needs.

Regards,
Daniel Schömer


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


Re: [m2] assembly plugin

Posted by Ashley Williams <ag...@mac.com>.
Thanks that worked although I didn't find what I was hoping for in  
the resulting zip file.

On 20 Sep 2005, at 12:49, Daniel Schömer wrote:

> Hi.
>
> Ashley Williams wrote:
>
>> Does anyone know how to use assembly:assembly, in particular what the
>> descriptor is supposed to be? I did hardcode it as a path to my pom
>> from within my pom (that seems wrong) which made the plugin run
>> without errors, but I didn't see any output file.
>>
>
> As far as I could examine the source of the assembly plugin, the
> descriptor is a xml file that contains a description of what to
> asseble.  The "descriptor" property is a path to such a file and
> descriptorId is the id of a descriptor that is known to the assembly
> plugin.
>
> Is seems the assembly descriptors currently provided by the  
> assembly plugin
> are there:
>
>   http://svn.apache.org/viewcvs.cgi/maven/components/trunk/maven- 
> plugins/maven-assembly-plugin/src/main/resources/assemblies/
>
> I've successfully run assembly:assembly setting descriptorId to one of
> the id in the provided assemblies ("bin", "src" or
> "jar-with-dependencies").
>
>
>
> Regards,
> Daniel Schömer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


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


Re: [m2] assembly plugin

Posted by Daniel Schömer <da...@gmx.net>.
Hi.

Ashley Williams wrote:
> Does anyone know how to use assembly:assembly, in particular what the  
> descriptor is supposed to be? I did hardcode it as a path to my pom  
> from within my pom (that seems wrong) which made the plugin run  
> without errors, but I didn't see any output file.

As far as I could examine the source of the assembly plugin, the
descriptor is a xml file that contains a description of what to
asseble.  The "descriptor" property is a path to such a file and
descriptorId is the id of a descriptor that is known to the assembly
plugin.

Is seems the assembly descriptors currently provided by the assembly plugin
are there:

  http://svn.apache.org/viewcvs.cgi/maven/components/trunk/maven-plugins/maven-assembly-plugin/src/main/resources/assemblies/

I've successfully run assembly:assembly setting descriptorId to one of
the id in the provided assemblies ("bin", "src" or
"jar-with-dependencies").

  m2 assembly:assembly -Dmaven.assembly.descriptorId=bin

Regards,
Daniel Schömer


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