Hello,

I think you are misusing mirrors. Really. [?]

Please be sure you read this
http://maven.apache.org/guides/introduction/introduction-to-repositories.html

Just add your internal repository to pom.xml as additional repository and
configure project to deploy your artifacts into internal repository. And
there won't be any need to switch between profiles.

Regards,
Alexander

2009/7/30 dbruley <[email protected]>

>
> Hello,
>
> Apologize if this posted twice, but it's been several days since I sent the
> first email and I have not seen my post come across. Trying again.
>
> I spent quite a bit of time reading the Maven documentation as well as
> trying my luck on Google, so hopefully I didn't miss something easy or
> obvious.
>
> For the usual reasons of governance, security, etc we use an internal maven
> repository for our builds (Artifactory).  In the settings.xml file under
> /conf we have defined two profiles: one that lists a variety of
> repositories
> in the external world (id=external-repos) and one that only defines our
> internal repository (id=internal-repos).  The internal-repos is set as
> active, but external-repos is available via the -P from command line if we
> need to look external to bring artifacts down locally for things such as
> version upgrades.
>
> Noticed running help:effective-pom that the maven super pom brings in
> repo1.maven.org/maven2 and I suspect that poms from third party
> dependencies
> might also specify external repos that get referenced during builds.  I did
> some browsing and came across the topic of specifying a mirror in the
> settings.xml file where one could redirect everything to an internal repo
> such as
>
>        <mirror>
>            <id>internal-repository-mirror</id>
>            <name>Internal Maven Repository Mirror Site</name>
>            <url>http://some.internal.url</url>
>            <mirrorOf>*</mirrorOf>
>        </mirror>
>
> That sounded exactly like what I needed except it seems to be global
> regardless of the profile and I don't want to have to comment it out all
> the
> time on the occasions I do need to point to an external repo.
>
> I fooled around with trying to use a property for mirrorOf based on the
> active profile such as what follows but that didn't seem to work:
>
>        <mirror>
>            <id>internal-repository-mirror</id>
>            <name>Internal Maven Repository Mirror Site</name>
>            <url>http://some.internal.url</url>
>            <mirrorOf>${repo.mirror}</mirrorOf>
>        </mirror>
>
>        <profile>
>            <id>external-repos</id>
>            <properties>
>                <repo.mirror>internal</repo.mirror>
>            </properties>
>            <repositories>
>                 ....
>            </repositories>
>        </profile>
>
>        <profile>
>            <id>internal-repos</id>
>            <properties>
>                <repo.mirror>*</repo.mirror>
>            </properties>
>            <repositories>
>                 ....
>            </repositories>
>        </profile>
>
> So my question is, does Maven allow for any kind of dynamic mirror
> configuration or is there some way to accomplish what I need, which is if
> I'm using a profile for internal only all sites mirror to the internal repo
> and if I'm using the profile for external allowed, I bypass the mirror all
> rule so I can reach the external repos?
>
> Saw an existing JIRA that I believe is related -
> http://jira.codehaus.org/browse/MNG-3525 - but wondering if anyone has
> been
> able to work around the lack of mirrors in profiles.
>
> We're currently using Maven 2.0.5, although we need to migrate to a newer
> version.
>
> Thanks in advance for any assistance.
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Setting-Mirror-properties-by-profile--tp24738774p24738774.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to