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 17:42:51 UTC

Re: [m2] assembly plugin + a few instructions

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 + 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