You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rob Dickens <ro...@lafros.com> on 2006/03/29 14:24:47 UTC

jar packaging: how to include other jars?

Dear Maven Users,

My project contains three sub-projects as follows:

mylib
|
+-mylib-core (jar packaging)
|
+-mylib-demo (jar packaging)
|
+-mylib-dist (jar packaging)

I want the last sub-project to produce a jar-file containing the  
following:

index.html
demo.html
demo.jnlp
juice-core-<version>.jar
juice-demo-<version>.jar

So I put the first three files into mylib/mylib-dist/src/main/ 
resources/. The question is, how do I get the jarfiles copied?

Should I be using the assembly plugin perhaps? If so, would the  
preferred format be zip?

Thanks,

Rob

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


Re: jar packaging: how to include other jars?

Posted by Rob Dickens <ro...@lafros.com>.
On 29 Mar 2006, at 13:35, Emmanuel Venisse wrote:

> You can use the assembly plugin (http://maven.apache.org/guides/ 
> mini/guide-assemblies.html), it will be the best solution.
> The preferred format is what you want ;-) (zip, tar, tar.gz,  
> tar.bz2, jar...)
>
> Emmanuel

Many thanks for this reply.

After some trial and error, I finally got it to work:

* mylib-dist packaging changed to pom

* the following added to mylib-dist/pom.xml (which must also specify  
the dependencies on the jar-files from the other two modules):
   <build>
     <plugins>
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
         <configuration>
           <descriptors>
             <descriptor>src/main/assembly/whatever.xml</descriptor>
           </descriptors>
         </configuration>
       </plugin>
     </plugins>
   </build>

* added mylib-dist/src/main/assembly/whatever.xml:
<assembly>
   <id>applet-jnlp</id>
   <formats>
     <format>zip</format>
   </formats>
   <includeBaseDirectory>false</includeBaseDirectory>
   <fileSets>
     <fileSet>
       <directory>src/main/resources</directory>
       <outputDirectory>/</outputDirectory>
     </fileSet>
   </fileSets>
   <dependencySets>
     <dependencySet>
       <outputDirectory>/</outputDirectory>
       <unpack>false</unpack>
       <scope>runtime</scope>
     </dependencySet>
   </dependencySets>
</assembly>

* from mylib/mylib-dist/ ran 'mvn assembly:assembly' to generate  
the .zip or 'mvn assembly:directory' to generate a directory  
containing the said files


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


Re: jar packaging: how to include other jars?

Posted by Emmanuel Venisse <em...@venisse.net>.

Rob Dickens a écrit :
> Dear Maven Users,
> 
> My project contains three sub-projects as follows:
> 
> mylib
> |
> +-mylib-core (jar packaging)
> |
> +-mylib-demo (jar packaging)
> |
> +-mylib-dist (jar packaging)
> 
> I want the last sub-project to produce a jar-file containing the  
> following:
> 
> index.html
> demo.html
> demo.jnlp
> juice-core-<version>.jar
> juice-demo-<version>.jar
> 
> So I put the first three files into mylib/mylib-dist/src/main/ 
> resources/. The question is, how do I get the jarfiles copied?
> 
> Should I be using the assembly plugin perhaps? If so, would the  
> preferred format be zip?

You can use the assembly plugin (http://maven.apache.org/guides/mini/guide-assemblies.html), it will 
be the best solution.
The preferred format is what you want ;-) (zip, tar, tar.gz, tar.bz2, jar...)

Emmanuel

> 
> Thanks,
> 
> Rob
> 
> ---------------------------------------------------------------------
> 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