Chirstian,

the problem is that the pom for the dependency that he wants to use declares
repositories to use for resolving its transitive dependencies.

He does not want to have that repository dragged in to his build.

Other than re-releasing the jar with a different version (e.g. releasing
log4j:log4j:1.2.14-mycompany-1 it'd be the same jar as 1.2.14, but using a
hand rolled pom) there is no real solution to this.

I know that plans for Maven 2.2 or 3.0 or some such is/was to deprecate the
declaration of repositories within the pom because of this very problem.

Of course banning repository declarations within poms is a swings and
roundabouts solution:
+ fix this type of problem
- cause problems if you need something that you cannot get pushed into repo1

Stephen

On Fri, Sep 12, 2008 at 8:11 AM, Christian Schuhegger <
[EMAIL PROTECTED]> wrote:

> Hi Martin,
>
> Martin Höller wrote:
>
>> On Thursday 11 September 2008 Wendy Smoak wrote:
>>
>>> On Thu, Sep 11, 2008 at 5:03 AM, Martin Höller <[EMAIL PROTECTED]> wrote:
>>>
>>>> Unfortunately this dependency's pom.xml specifies other remote
>>>> repositories. Could someone please tell me what is the recomended way
>>>> to avoid getting a new repository into my environment?
>>>>
>>> You can use mirrors, especially mirrorOf=*, to prevent additional
>>> repositories from being introduced.
>>>
>>> http://maven.apache.org/guides/mini/guide-mirror-settings.html
>>>
>>
>> That doesn't prevent additional repositories of beeing introduced. It just
>> prevents direct usage of them, which is IMHO just a workaround but no
>> solution.
>>
>
> I am not sure what you try to do? You want to add a new jar file, but you
> do not want to introduce a dependency to the repository where that jar file
> lives, right?
>
> Let's introduce some names:
> - your pom : project.pom.xml
> - the dependency that you introduced by hand : A.pom.original.xml
> - a sub dependency that A.pom.original.xml mentions : B.pom.xml
>
> That jar file has in its A.pom.original.xml other dependencies that live in
> other remote repositories that you do not want to introduce in your
> project.pom.xml of your project. For sure the jar that you included needs
> these additional dependencies, because otherwise it would not mention them
> in its A.pom.original.xml in the first place.
>
> If you fulfilled those dependencies on the several B.pom.xml already by
> some other way, e.g. you introduced them in your local repository by hand
> and introduced those dependencies into your project.pom.xml via a separate
> <dependency/>, then you can use <exclude/> on the original dependency that
> you have in project.pom.xml like that:
>                        <dependency>
>                                <groupId>...</groupId>
>                                <artifactId>A</artifactId>
>                                <version>...</version>
>                                <exclusions>
>                                        <exclusion>
>                                                <groupId>...</groupId>
>                                                <artifactId>B</artifactId>
>                                        </exclusion>
> ...
>                                </exclusions>
>                        </dependency>
>
> In this case maven will not try to resolve the dependencies you have in the
> A.pom.original.xml
>
> Another even simpler way is to create a A.pom.modified.xml yourself for
> your jar that you introduced in your local repository :) Why do you want to
> use the A.pom.original.xml that you downloaded manually from the remote
> repository if that pom.xml causes you problems?
>
> I hop that helps,
> --
> Christian Schuhegger
> http://www.el-chef.de/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to