You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kristian Rink <ka...@zimmer428.net> on 2009/09/22 08:07:52 UTC

war artifacts: copying dependent .jars elsewhere instead of bundling them?

Folks;

maybe a strange use case again, however: We're using maven2 along with
Spring and some other libraries included to build web applications, deployed
to .war files, usually deployed to contain all the dependent .jars in
WEB-INF/lib. While this is good in most situations, we found that in one
environment, there is a bunch of separated applications mainly using all the
same .jar files so we would be better off moving them to an application
server shared jar folder and keeping the .war files smaller without
distributing all the same libraries over and over again.

Question: How to achieve this? My first idea was to make all the
dependencies in the war artifact poms "provided" and copy them over
manually, but, at the very least dealing with transitive dependencies and
exclusions, this has proven not to be funny. Can I somehow make the maven2
war build, say, copy the .jar files anywhere else but in the
target/<webapp-name> folder to manually copy them over to the application
server?

Thanks in advance and all the best,
Kristian


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


Re: war artifacts: copying dependent .jars elsewhere instead of bundling them?

Posted by Kristian Rink <ka...@zimmer428.net>.
Anders Hammar schrieb:
> You can have one project with a primary artifact (including all
> dependencies) and an extra artifact (w/o deps) using a classifier. I don't
> think you should worry about have many artifacts. If you do that, then you
> will have problems with maven...:-)

I see. :) So by then this is the way I'm about to go, seems indeed the
cleanest approach of doing things. Thanks again for your help and all the best!
Kristian



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


Re: war artifacts: copying dependent .jars elsewhere instead of bundling them?

Posted by Anders Hammar <an...@hammar.net>.
>
> Anders Hammar schrieb:
> > I think you should have scope 'provided'. Your use case is what that's
> for.
>
> Yes, that's what I thought as well, but, well, it's not always the case -
> we're using the same app code base for various deployments, but in not all
> situations the artifacts actually _are_ provided / to be placed in the
> server environment... And so far I hesitated having two different war
> artifacts just to address this issue... but maybe it would be a cleaner
> solution?
>
>
You can have one project with a primary artifact (including all
dependencies) and an extra artifact (w/o deps) using a classifier. I don't
think you should worry about have many artifacts. If you do that, then you
will have problems with maven...:-)

/Anders

Re: war artifacts: copying dependent .jars elsewhere instead of bundling them?

Posted by Kristian Rink <ka...@zimmer428.net>.
Hi Anders;

and first, thanks a bunch for your comments, much appreciated. :)

Anders Hammar schrieb:
> I think you should have scope 'provided'. Your use case is what that's for.

Yes, that's what I thought as well, but, well, it's not always the case -
we're using the same app code base for various deployments, but in not all
situations the artifacts actually _are_ provided / to be placed in the
server environment... And so far I hesitated having two different war
artifacts just to address this issue... but maybe it would be a cleaner
solution?


> Regarding handling your dependencies for production, that's more of a server
> deployment issue isn't it? What I think you can use is the copy-dependensies
> mojo of the dependency plugin (
> http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html).
> As the dependencies are shared between several applications, I would create
> a separate project where I do this and the put them in an assembly (zip/tar
> file).

Thanks for pointing me there, taking a first look this seems pretty much
what I need. I'll play around with it and see how far it gets me; at the
moment, thanks a bunch again for your help. :)

Cheers,
Kristian


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


Re: war artifacts: copying dependent .jars elsewhere instead of bundling them?

Posted by Anders Hammar <an...@hammar.net>.
I think you should have scope 'provided'. Your use case is what that's for.

Regarding handling your dependencies for production, that's more of a server
deployment issue isn't it? What I think you can use is the copy-dependensies
mojo of the dependency plugin (
http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html).
As the dependencies are shared between several applications, I would create
a separate project where I do this and the put them in an assembly (zip/tar
file).

/Anders

On Tue, Sep 22, 2009 at 08:07, Kristian Rink <ka...@zimmer428.net> wrote:

> Folks;
>
> maybe a strange use case again, however: We're using maven2 along with
> Spring and some other libraries included to build web applications,
> deployed
> to .war files, usually deployed to contain all the dependent .jars in
> WEB-INF/lib. While this is good in most situations, we found that in one
> environment, there is a bunch of separated applications mainly using all
> the
> same .jar files so we would be better off moving them to an application
> server shared jar folder and keeping the .war files smaller without
> distributing all the same libraries over and over again.
>
> Question: How to achieve this? My first idea was to make all the
> dependencies in the war artifact poms "provided" and copy them over
> manually, but, at the very least dealing with transitive dependencies and
> exclusions, this has proven not to be funny. Can I somehow make the maven2
> war build, say, copy the .jar files anywhere else but in the
> target/<webapp-name> folder to manually copy them over to the application
> server?
>
> Thanks in advance and all the best,
> Kristian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>