Alternatively, if you just need a copy of the jar, and not the jar on the
classpath, ie you are writing some app that builds its own classpath, some
parts of the app use one version and other parts use the other version, and
you have fancy code that sets up the class loaders correctly, this would be
an ideal illustration of why dependency:copy can be needed sometimes (ie
dependency:copy-dependencies does not fit this use-case)

Though IMHO I would rather wrap the code that needs the older version in a
separate jar that uses maven-shade-plugin to remove the need for class
loader trickery, if you have your own plugin framework, that might not be
tractable...

Having said all that, 99% chance is that none of the above apply to your
case, and you are just fighting maven because you think you can win... Well
you won't win.

On Friday, 17 February 2012, Wayne Fay <wayne...@gmail.com> wrote:
>> <dependencies>
>>       <dependency>
>>           <groupId>test</groupId>
>>           <artifactId>castor</artifactId>
>>           <version>0.9.5</version>
>>       </dependency>
>>       <dependency>
>>           <groupId>test</groupId>
>>           <artifactId>castor</artifactId>
>>           <version>1.0.4</version>
>>       </dependency>
>> </dependencies>
> ...
>> But this copies only one version and it ignores the other one.. Please
>> provide a solution for copying both the versions.
>
> Why do you want to do this? As you've already discovered, Maven will
> generally "collapse" two such dependencies into a single element and
> pick one version over the other.
>
> If you have any ability to control the GA coordinates or to add a C
> (classifier) to one of the artifacts, you should do so as that would
> be the easiest possible solution. Then Maven would consider them as
> "different" and you could bring in both versions very easily.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to