You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Brian Enigma <en...@netninja.com> on 2004/03/03 01:52:30 UTC

Building multiple jars with Maven

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

     I searched through the maven-users archive for my question and  
found something close to what I am looking for  
(http://nagoya.apache.org/eyebrowse/ReadMsg? 
listName=users@maven.apache.org&msgId=808818), but either it does not  
quite fit my scenario or I do not understand it as well as I think.

     Anyway, I have a cvs project containing common utility source code  
that gets used across a number of our projects.  This is all library  
code--there is no main(), just a few unit tests.  This project includes  
packages such as:

  com.mycompany.util.crypto
  com.mycompany.util.log
  com.mycompany.util.string
  com.mycompany.util.xml
  ...etc...

     The ant script we currently employ builds multiple jar files from  
this source: mycompany-crypto.jar, mycompany-xml.jar, etc.  This has to  
be done because of various legal reasons as well as minimizing the size  
of distributed applications.  We do not want to build one gigantic util  
jar file containing everything because we do not want to (or cannot)  
ship the crypto classes to everyone.  Nor do we want to ship our custom  
XML code out with a program that does not utilize it in order to  
minimize download sizes as well as exposed object code (which can be  
decompiled).

     I am in the process of evaluating Maven to replace or coexist with  
our existing Ant build process.  For final release projects, Maven is  
great because I can tell it where to find mycompany-crypto.jar, etc.   
For this core "util" project, I am having difficulty figuring out how  
to best model the behavior I need in Maven.  Is there a way to have a  
single project.xml output half a dozen jar files--one for each package?  
  Will I have to resort to multiple project files (project-crypto.xml,  
project-xml.xml, etc) with one master project.xml to bind them all?   
Should I stick with the existing Ant scripts in this one case?
  -Brian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFARSxR0dKNWt3rpSURAkx1AKDnfZtxf+mSCgPab23ZvA6P51UizwCgpEtI
PieRJxaq2YPkDKgWEX+0oaM=
=8J0h
-----END PGP SIGNATURE-----


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


Re: Building multiple jars with Maven

Posted by Jason van Zyl <jv...@maven.org>.
On Tue, 2004-03-02 at 19:52, Brian Enigma wrote:

>      I am in the process of evaluating Maven to replace or coexist with  
> our existing Ant build process.  For final release projects, Maven is  
> great because I can tell it where to find mycompany-crypto.jar, etc.   
> For this core "util" project, I am having difficulty figuring out how  
> to best model the behavior I need in Maven.  Is there a way to have a  
> single project.xml output half a dozen jar files--one for each package?

This is something that is discouraged in Maven which is why there is
only one allowable entry for the source directory.

If you have multiple jars being output where each JAR addresses a
different concern then what Maven encourages is that you put these in
separate projects.

>   
>   Will I have to resort to multiple project files (project-crypto.xml,  
> project-xml.xml, etc) with one master project.xml to bind them all?

We don't consider this a "last resort", we consider this normal.

> Should I stick with the existing Ant scripts in this one case?

No, I would suggest you break up your build. But if you want to output
many JARs from one build then stick with Ant.

-- 
jvz.

Jason van Zyl
jason@maven.org
http://maven.apache.org

happiness is like a butterfly: the more you chase it, the more it will
elude you, but if you turn your attention to other things, it will come
and sit softly on your shoulder ...

 -- Thoreau 


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


Re: Building multiple jars with Maven

Posted by Eric Giguere <er...@videotron.ca>.
Hi there
I would say if you like what Maven does and is, do the migration. I did 
it at my company. Basically, Maven is kind of a Super-Ant ( and much 
much more).

There are multiple ways to make Maven do what you need. By design, it 
produces one artifact per project, so you could for instance make one 
project per jar. Or, you could just migrate the existing Ant code and 
put it in your maven.xml with a new goal calling that code.

And if you migrate from an Ant based build system, I think you should 
know that your Ant script, as it is now, could be very easily integrated 
into Maven since any Ant targets can be called in a maven.xml script.

Hope it helps.
Eric.

Brian Enigma wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>     I searched through the maven-users archive for my question and  
> found something close to what I am looking for  
> (http://nagoya.apache.org/eyebrowse/ReadMsg? 
> listName=users@maven.apache.org&msgId=808818), but either it does not  
> quite fit my scenario or I do not understand it as well as I think.
>
>     Anyway, I have a cvs project containing common utility source 
> code  that gets used across a number of our projects.  This is all 
> library  code--there is no main(), just a few unit tests.  This 
> project includes  packages such as:
>
>  com.mycompany.util.crypto
>  com.mycompany.util.log
>  com.mycompany.util.string
>  com.mycompany.util.xml
>  ...etc...
>
>     The ant script we currently employ builds multiple jar files from  
> this source: mycompany-crypto.jar, mycompany-xml.jar, etc.  This has 
> to  be done because of various legal reasons as well as minimizing the 
> size  of distributed applications.  We do not want to build one 
> gigantic util  jar file containing everything because we do not want 
> to (or cannot)  ship the crypto classes to everyone.  Nor do we want 
> to ship our custom  XML code out with a program that does not utilize 
> it in order to  minimize download sizes as well as exposed object code 
> (which can be  decompiled).
>
>     I am in the process of evaluating Maven to replace or coexist 
> with  our existing Ant build process.  For final release projects, 
> Maven is  great because I can tell it where to find 
> mycompany-crypto.jar, etc.   For this core "util" project, I am having 
> difficulty figuring out how  to best model the behavior I need in 
> Maven.  Is there a way to have a  single project.xml output half a 
> dozen jar files--one for each package?   Will I have to resort to 
> multiple project files (project-crypto.xml,  project-xml.xml, etc) 
> with one master project.xml to bind them all?   Should I stick with 
> the existing Ant scripts in this one case?
>  -Brian
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (Darwin)
>
> iD8DBQFARSxR0dKNWt3rpSURAkx1AKDnfZtxf+mSCgPab23ZvA6P51UizwCgpEtI
> PieRJxaq2YPkDKgWEX+0oaM=
> =8J0h
> -----END PGP SIGNATURE-----
>
>
> ---------------------------------------------------------------------
> 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