I got some thing working
1. at my repo manager, create a proxy, called plugin-central, to host
another central.maven.org/maven2
2. reconfigure my global settings.xml with the following contents. Please
help to review this content
<mirrors>
<mirror>
<id>product-repo</id>
<mirrorOf>*,!plugin-central</mirrorOf>
<name>Internal Maven Repository Manager</name>
<url>http://repos.xxx.com:8081/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>plugin-repo</id>
<mirrorOf>plugin-central</mirrorOf>
<name>Internal Maven Repository Manager for plugin and its transitive
dependencies</name>
<url>http://repos.xxxx.com:8081/nexus/content/groups/plugin-public
</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>redefine-default-repositories</id>
<repositories>
<repository>
<!-- do we really need this?? since it is mirrored any way -->
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- this allow use to separate product and plugin dependencies
into separate mirrors/proxy -->
<pluginRepository>
<id>plugin-central</id> <!--must be first in list -->
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
<!-- plugin download should never get here since 'central' already
cover by another proxy in plugin-central mirror-->
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>redefine-default-repositories</activeProfile>
</activeProfiles>
Thank you every one for participate in this discussion, specially Anders
for leading to this solution
If you have anything you want to add please chime in
-Dan
On Sat, May 24, 2014 at 1:19 AM, Anders Hammar <[email protected]> wrote:
> It will if you use the same id, ie 'central'.
>
> /Anders (mobile)
> Den 24 maj 2014 09:36 skrev "Dan Tran" <[email protected]>:
>
> > Anders' suggestion sounds very logical
> >
> > however, i found this at super pom
> >
> > <repositories>
> > <repository>
> > <id>central</id>
> > <name>Central Repository</name>
> > <url>http://repo.maven.apache.org/maven2</url>
> > <layout>default</layout>
> > <snapshots>
> > <enabled>false</enabled>
> > </snapshots>
> > </repository>
> > </repositories>
> >
> > <pluginRepositories>
> > <pluginRepository>
> > <id>central</id>
> > <name>Central Repository</name>
> > <url>http://repo.maven.apache.org/maven2</url>
> > <layout>default</layout>
> > <snapshots>
> > <enabled>false</enabled>
> > </snapshots>
> > <releases>
> > <updatePolicy>never</updatePolicy>
> > </releases>
> > </pluginRepository>
> > </pluginRepositories>
> >
> > Is there a way to disable/clear out the super pom pluginRepositories?
> > If I add my own pluginRepositories, will it override the super pom
> > one?
> >
> >
> > Thanks
> >
> > Dan
> >
> >
> >
> >
> > On Tue, May 6, 2014 at 6:20 AM, Barrie Treloar <[email protected]>
> wrote:
> >
> > > On 6 May 2014 20:23, Anders Hammar <[email protected]> wrote:
> > >
> > > > >
> > > > > Presumably you are trying to separate artifacts used by plugins
> > during
> > > > > your build (where you might use e.g. GPL licensed modules) from
> > > artifacts
> > > > > used as dependencies in your project proper (where using that same
> > GPL
> > > > > licensed modules would make your legal department scream) by
> > separating
> > > > the
> > > > > repositories used to provide them.
> > > > >
> > > > > As far as I know/understand all artifacts are downloaded to the
> same
> > > > local
> > > > > cache repository (~/.m2/repository), regardless of whether they
> were
> > > > > required by some plugin or as a dependency of your project.
> > > > >
> > > > > This makes them available for both purposes and thus obliterates
> all
> > > your
> > > > > efforts of keeping them separate.
> > > > >
> > > > > Maven Masters: Please correct me if I'm wrong.
> > > > >
> > > >
> > > > I don't think this is correct with Maven 3. Maven 3 uses Aether which
> > > AFAIK
> > > > keeps the repository id for the artifact to verify from where it was
> > > > downloaded. Haven't verified for this use case though.
> > > >
> > > > So, using Maven 3 it should be possible to specify one repository
> > > > declaration for your deps and one pluginRepository declaration (with
> a
> > > > different repo id) for your plugins (incl deps). If you msut use
> mirror
> > > > declarations, I would use this for the deps and add exclusions (using
> > > '!')
> > > > for any pluginRepository.
> > > >
> > > > /Anders
> > >
> > >
> > > I don't remember what happens for duplicates.
> > > I think it used to complain that the artifact doesn't exist (if the one
> > it
> > > downloaded from is not available, even though its available elsewhere).
> > >
> > > The GPL example isn't a good one, as the output of running GPL is not
> GPL
> > > itself.
> > >
> > > I think Nexus allows you to restrict things by licence so that you can
> > > curate what is available in your repository manager. You'd have to look
> > at
> > > the docs to find out.
> > >
> >
>