You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Hoeher, Alexander" <al...@jamba.net> on 2008/06/27 11:35:17 UTC

problem: disambiguate jar names of jars taken from Maven repo (finalName does not apply here)

Hello Maven people,
 
I have the current version of Maven, Maven 2.0.9 installed.
Any helpful comments welcome!
 
A. Problem
This is the problem, abstract: 
How can I disambiguate jar names of jars taken from Maven repo (for
example for web app deployment)? 
Unique jar names including the groupid are needed, not only in the
target dir, but also in dealing with the Maven repo jars.
project.build.finalName does not help here, see below solution approach
1.
 
This is the problem, concrete: 
For the deployment of jars to a local web app, the current deployment
process just copies the jars as is from the Maven repo into WEB-INF/lib.
Jars in the repo just have artefactid-version-based names that are not
unique, however. 
Stuffing these jars all into the same WEB-INF/lib will let some jars be
overwritten.
So, unique jar names are needed.
This means, the groupid must be included in the jar name.
 
 
B. Solution space:
I see 3 possible approaches to the problem at hand:
 
1. Let Maven install plugin write jars with unique names,
groupid-artefactid-version-based names, into the repo on install.
How can I get Maven to do this?
The "obvious" implementation does not work, as project.build.finalName
does not affect jar names in the Maven repo:
The jars created under target dir have names with groupid included
alright, as project.build.finalName has been configured.
Say my jar under target is called "group-artifact-2.0.jar".
 
But when copied to the Maven repo, where the groupid is represended by a
containing folder, these jars are renamed with an artifactid-only jar
name.
So now my jar in the repo is called "artifact-2.0.jar".
 
2. Let Maven deploy plugin rename the repo jar on deployment including
the groupid in the jar name.
This would work as well.
Is there a way to get Maven to do this?
 
3. Manually extending artifactid with groupid (dirty).
Artefactids can disambiguated by including the groupid, of course.
This introduces a bit of redundancy, though. It does not look nice.
 
Some hints for the implementation of one of the first approaches would
be very much appreciated!
Thanks in advance,
 
Alex

Re: problem: disambiguate jar names of jars taken from Maven repo (finalName does not apply here)

Posted by Stephen Connolly <st...@gmail.com>.
On Fri, Jun 27, 2008 at 10:35 AM, Hoeher, Alexander <
alexander.hoeher@jamba.net> wrote:

> Hello Maven people,
>
> I have the current version of Maven, Maven 2.0.9 installed.
> Any helpful comments welcome!
>
> A. Problem
> This is the problem, abstract:
> How can I disambiguate jar names of jars taken from Maven repo (for
> example for web app deployment)?
> Unique jar names including the groupid are needed, not only in the
> target dir, but also in dealing with the Maven repo jars.
> project.build.finalName does not help here, see below solution approach
> 1.
>
> This is the problem, concrete:
> For the deployment of jars to a local web app, the current deployment
> process just copies the jars as is from the Maven repo into WEB-INF/lib.
> Jars in the repo just have artefactid-version-based names that are not
> unique, however.
> Stuffing these jars all into the same WEB-INF/lib will let some jars be
> overwritten.
> So, unique jar names are needed.
> This means, the groupid must be included in the jar name.
>

AFAIK, if you have an artifactId clash, then the war plugin automatically
changes the names of both to be prefixed with the groupId.

So this scenario is not a problem

-Stephen


>
>
> B. Solution space:
> I see 3 possible approaches to the problem at hand:
>
> 1. Let Maven install plugin write jars with unique names,
> groupid-artefactid-version-based names, into the repo on install.
> How can I get Maven to do this?
> The "obvious" implementation does not work, as project.build.finalName
> does not affect jar names in the Maven repo:
> The jars created under target dir have names with groupid included
> alright, as project.build.finalName has been configured.
> Say my jar under target is called "group-artifact-2.0.jar".
>
> But when copied to the Maven repo, where the groupid is represended by a
> containing folder, these jars are renamed with an artifactid-only jar
> name.
> So now my jar in the repo is called "artifact-2.0.jar".
>
> 2. Let Maven deploy plugin rename the repo jar on deployment including
> the groupid in the jar name.
> This would work as well.
> Is there a way to get Maven to do this?
>
> 3. Manually extending artifactid with groupid (dirty).
> Artefactids can disambiguated by including the groupid, of course.
> This introduces a bit of redundancy, though. It does not look nice.
>
> Some hints for the implementation of one of the first approaches would
> be very much appreciated!
> Thanks in advance,
>
> Alex
>