On Sat, 2006-04-22 at 03:25 -0500, Gautham Pamu wrote:
> Hi Everyone,
> 
> I have strange scenario. I have two web projects, one web project A is
> accesing code from another web project B. Since
> RAD allows it, the developer add the dependency on another web project in
> RAD.
> 
> Even though I defined the dependency in pom.xml between the web projects,
> the second web project  A is not able
> to see the classes from ther other webproject. How should I define the
> dependency for this project....


In order for project A to have a dependency on a jar, it needs to be
able to point to that jar in the local maven repository. However when a
"war" project is installed into a repository, it is the .war that is
installed; there is therefore nothing suitable for A to point to.

I guess it's possible to use "brute force". The maven-assembly-plugin
allows you to build a jarfile containing whatever you want from the
project. And the maven-install-plugin allows you to install whatever
artifacts you want into the local repository. You could therefore attach
a custom assembly definition to the "assemble" phase, and a custom
install definition to the "install" phase, using <execute> tags.

It's quite common to generate "variants" of projects (sorry, there's
some maven terminology for this which I can't remember for the moment).
For example, a jar project can build foo.jar plus variants like
foo-src.jar, foo-jdk14.jar, etc. Anyone know if this mechanism could be
used to add a jarfile of the classes for a webapp (or some subset of
them) as one of its generated artifacts? Or is it done just like the
approach described above?

Otherwise I think you *have* to split up project B into two parts: a
"jar" project and a "war" project. Both A and b-war can then depend on
B-jar. It's certainly the cleanest solution.

NB: I'm no maven guru; any or all of the above could be wrong :-)

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to