Re: Maven dependency

Turadg Aleahmad <[email protected]> Fri, 22 Oct 2004 10:12:59 -0700
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
Matthias Radestock wrote:

> I gather maven is adding the jars of declared dependencies to the 
> class path. So perhaps the difficulty with the above is that the jar 
> contains other jars/files rather than the classes themselves.


Exactly right.

> How can we get around that? Is there a way to create a bundle 
> containing multiple jars?


I tried for a while but basically Maven doesn't like it.  In their words 
from http://wiki.codehaus.org/maven/CreatingWebApplications :
<<
Maven is "limited" (by design) to creating one artifact per project. 
However using a plugin, additional artifacts can be created, however 
this technique should not be used to bypass the one artifact per project 
rule.

However, that being said, Maven can create a jar artifact as well as an 
associated war artifact using the same code-base.

If you have the desire to generate multiple artifacts as you have common 
code across the set, this is typically resolved by extracting that 
common code out into a separate artifact and using it via Maven's 
dependency mechanism.
 >>

There's also this argument:
  
http://wiki.codehaus.org/maven/WhyYouCantCreateMultipleArtifactsInOneProject


> Or perhaps each jar should be a different artifact?


So I think that would mean different projects as well.  Which could make 
sense.  For example, there could be "sisc-heap-lite" and 
"sisc-heap-full" which both depend on "sisc".

But what's the real problem with how Maven is bundling it now?

> But then what should happen to the non-jar artifacts like shell scripts?


I don't think shell scripts are relevant for the Maven repository.  The 
repository isn't a software distribution system; it's a canonical place 
for getting JAR dependencies.  There's no Java code that depends on sisc.sh.

There will always be the real distribution archive on the SourceForge 
site.  Incidentally, there's a plugin that seeks to automate that:
  http://maven-plugins.sourceforge.net/maven-sourceforge-plugin/

> Another thing I noticed is that your maven.xml duplicates an ant task 
> from build.xml. Is there any way that the maven.xml could just refer 
> to the ant task in build.xml? The instructions at
>  http://maven.apache.org/ant-guide/qna/antfarming.html
> appear to suggest there is.


Yeah, first I tried simply <ant:ant target="quantity"> but some 
necessary variable wasn't bound.  I think it was ${classdir}.  I just 
wanted to get it working.  I think Maven has a cleaner way to handle the 
Quantity issue, maybe using the <sourceModifications> block in the POM.


-T



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl