You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Chris Helck <Ch...@us.icap.com> on 2007/08/22 20:35:32 UTC

M2: Need help with central repositories, and mirrors

Hi,

How can I redefine the central repository for specific profiles? I have
three profiles defined in my settings.xml: dev, qa, and cert. I want the
"dev" profile to use the default central repository, but I want the "qa"
and "cert" profiles to use specific (but different) in-house URLs. From
what I've read the preferred way of overriding the central repository is
to redirect it via the <mirror> tag in settings.xml. But I can't use
<mirrors/> at the <profile/> level, it only goes under <settings/>, so
the mirror ends up being a global redirect instead of a profile specific
redirect.

Should I disable central completely:
<mirror>
  <id>Null Central</id>
  <name>Null</name>
  <url/>
  <mirrorOf>central</mirrorOf>
</mirror>

And add http://repo1.maven.org/maven under a different repo id? The in
each <profile> I could define something lilke:
<repository>
  <id>my-central</id>
  ...
</repository>

BTW: I'm using maven 2.0.4 on Ubuntu.

Thanks,
Christopher Helck



**********************************************************************
This communication and all information (including, but not limited to,
 market prices/levels and data) contained therein (the "Information") is
 for informational purposes only, is confidential, may be legally
 privileged and is the intellectual property of ICAP plc and its affiliates
 ("ICAP") or third parties. No confidentiality or privilege is waived or
 lost by any mistransmission. The Information is not, and should not
 be construed as, an offer, bid or solicitation in relation to any
 financial instrument or as an official confirmation of any transaction.
 The Information is not warranted, including, but not limited, as to
 completeness, timeliness or accuracy and is subject to change
 without notice. ICAP assumes no liability for use or misuse of the
 Information. All representations and warranties are expressly
 disclaimed. The Information does not necessarily reflect the views of
 ICAP. Access to the Information by anyone else other than the
 recipient is unauthorized and any disclosure, copying, distribution or
 any action taken or omitted to be taken in reliance on it is prohibited. If
 you receive this message in error, please immediately delete it and all
 copies of it from your system, destroy any hard copies of it and
 notify the sender.
**********************************************************************


Re: M2: Need help with central repositories, and mirrors

Posted by Tim Kettler <ti...@udo.edu>.
Hi,

see comment inline

John Quinn schrieb:
> I'd like to piggy back on this thread, since my question is just drilling
> down further.
> 
> So, if I say have the following profile in my mvn home settings.xml:
> 
>    <profile>
>       <id>myRepository</id>
> 
>       <activation>
>         <jdk>1.4</jdk>
>       </activation>
> 
>       <repositories>
>         <repository>
>            <id>myRepository</id>
>            <name>Repository for myRepository builds</name>
>            <url>http://www.myhost.com/maven/myRepository</url>
>            <layout>default</layout>
>            <snapshotPolicy>always</snapshotPolicy>
>          </repository>
>       </repositories>
>     </profile>
> And then I put in the apache html directory my entire directory structure
> and files currently under my local repository under the apache html
> directory like so:
> 
> /var/www/html/maven/myRepository
> 
> Then I now will be getting everything from that repository instead of my
> local repository, true?

In theory yes. In practice it's not that simple. Even if they look 
similar a local and remote repository are different things. A remote 
repository has additional metadata that is missing in a local 
repository. See here [1] for example.

To get a valid remote repository you have to deploy your artifacts to it 
(see below for instruction).

Coincidently someone posted just today in this thread [6] a link to a 
shell script that converts a local to a remote repository. You may want 
to have a look at it.

> And how would I install new jars in the repository as they are needed, by a
> simple copy, or could I then use the install command to get  it to the
> remote repository?

As you use the install (for existing projects) or install-file (for 
3rd-party jars) mojos to install artifacts to a local repository you use 
the deploy respectivly deploy-file mojos for remote repositories. See 
[2], [3] and [4], [5] for instructions.

> Thanks,
> John

-Tim

[1] http://repo1.maven.org/maven2/org/hibernate/hibernate/maven-metadata.xml
[2] http://maven.apache.org/plugins/maven-install-plugin/
[3] http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
[4] http://maven.apache.org/plugins/maven-deploy-plugin/
[5] http://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html
[6] 
http://www.nabble.com/M2-How-to-populate-internal-repository--tf4318392s177.html#a12296445

[...]

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2: Need help with central repositories, and mirrors

Posted by John Quinn <qu...@gmail.com>.
I'd like to piggy back on this thread, since my question is just drilling
down further.

So, if I say have the following profile in my mvn home settings.xml:

   <profile>
      <id>myRepository</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
           <id>myRepository</id>
           <name>Repository for myRepository builds</name>
           <url>http://www.myhost.com/maven/myRepository</url>
           <layout>default</layout>
           <snapshotPolicy>always</snapshotPolicy>
         </repository>
      </repositories>
    </profile>
And then I put in the apache html directory my entire directory structure
and files currently under my local repository under the apache html
directory like so:

/var/www/html/maven/myRepository

Then I now will be getting everything from that repository instead of my
local repository, true?

And how would I install new jars in the repository as they are needed, by a
simple copy, or could I then use the install command to get  it to the
remote repository?

Thanks,
John


On 8/23/07, Tim Kettler <ti...@udo.edu> wrote:
>
> Additionally you need to keep in mind to use different local
> repositories as well when using the different profiles on the same
> machine. Else the artifacts from the different repositories will be mixed.
>
> -Tim
>
> Tim Kettler schrieb:
> > Hi,
> >
> > setting the mirror to an invalid url would certainly work but I imagine
> > you would get tons of warnings about failed repository accesses since
> > maven would still try download from the mirror.
> >
> > What I would do instead is to just overwrite the definition of central
> > in the qa and cert profiles like this:
> >
> >   <repositories>
> >     <repository>
> >       <id>central</id>
> >       <name>Internal replacement for the central repository</name>
> >       <url>http://bla.com/repository</url>
> >       <releases>
> >         <enabled>true</enabled>
> >       </releases>
> >       <snapshots>
> >         <enabled>false</enabled>
> >       </snapshots>
> >     </repository>
> >   </repositories>
> >
> >   <pluginRepositories>
> >     <pluginRepository>
> >       <id>central</id>
> >       <name>Internal replacement for the central repository</name>
> >       <url>http://bla.com/repository</url>
> >       <releases>
> >         <enabled>true</enabled>
> >       </releases>
> >       <snapshots>
> >         <enabled>false</enabled>
> >       </snapshots>
> >     </pluginRepository>
> >   </pluginRepositories>
> >
> > -Tim
> >
> > Chris Helck schrieb:
> >> Hi,
> >>
> >> How can I redefine the central repository for specific profiles? I have
> >> three profiles defined in my settings.xml: dev, qa, and cert. I want
> the
> >> "dev" profile to use the default central repository, but I want the
> "qa"
> >> and "cert" profiles to use specific (but different) in-house URLs. From
> >> what I've read the preferred way of overriding the central repository
> is
> >> to redirect it via the <mirror> tag in settings.xml. But I can't use
> >> <mirrors/> at the <profile/> level, it only goes under <settings/>, so
> >> the mirror ends up being a global redirect instead of a profile
> specific
> >> redirect.
> >>
> >> Should I disable central completely:
> >> <mirror>
> >>   <id>Null Central</id>
> >>   <name>Null</name>
> >>   <url/>
> >>   <mirrorOf>central</mirrorOf>
> >> </mirror>
> >>
> >> And add http://repo1.maven.org/maven under a different repo id? The in
> >> each <profile> I could define something lilke:
> >> <repository>
> >>   <id>my-central</id>
> >>   ...
> >> </repository>
> >>
> >> BTW: I'm using maven 2.0.4 on Ubuntu.
> >>
> >> Thanks,
> >> Christopher Helck
> >>
> >>
> >>
> >> **********************************************************************
> >> This communication and all information (including, but not limited to,
> >>  market prices/levels and data) contained therein (the "Information")
> is
> >>  for informational purposes only, is confidential, may be legally
> >>  privileged and is the intellectual property of ICAP plc and its
> >> affiliates
> >>  ("ICAP") or third parties. No confidentiality or privilege is waived
> or
> >>  lost by any mistransmission. The Information is not, and should not
> >>  be construed as, an offer, bid or solicitation in relation to any
> >>  financial instrument or as an official confirmation of any
> transaction.
> >>  The Information is not warranted, including, but not limited, as to
> >>  completeness, timeliness or accuracy and is subject to change
> >>  without notice. ICAP assumes no liability for use or misuse of the
> >>  Information. All representations and warranties are expressly
> >>  disclaimed. The Information does not necessarily reflect the views of
> >>  ICAP. Access to the Information by anyone else other than the
> >>  recipient is unauthorized and any disclosure, copying, distribution or
> >>  any action taken or omitted to be taken in reliance on it is
> >> prohibited. If
> >>  you receive this message in error, please immediately delete it and
> all
> >>  copies of it from your system, destroy any hard copies of it and
> >>  notify the sender.
> >> **********************************************************************
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: M2: Need help with central repositories, and mirrors

Posted by Tim Kettler <ti...@udo.edu>.
Additionally you need to keep in mind to use different local 
repositories as well when using the different profiles on the same 
machine. Else the artifacts from the different repositories will be mixed.

-Tim

Tim Kettler schrieb:
> Hi,
> 
> setting the mirror to an invalid url would certainly work but I imagine 
> you would get tons of warnings about failed repository accesses since 
> maven would still try download from the mirror.
> 
> What I would do instead is to just overwrite the definition of central 
> in the qa and cert profiles like this:
> 
>   <repositories>
>     <repository>
>       <id>central</id>
>       <name>Internal replacement for the central repository</name>
>       <url>http://bla.com/repository</url>
>       <releases>
>         <enabled>true</enabled>
>       </releases>
>       <snapshots>
>         <enabled>false</enabled>
>       </snapshots>
>     </repository>
>   </repositories>
> 
>   <pluginRepositories>
>     <pluginRepository>
>       <id>central</id>
>       <name>Internal replacement for the central repository</name>
>       <url>http://bla.com/repository</url>
>       <releases>
>         <enabled>true</enabled>
>       </releases>
>       <snapshots>
>         <enabled>false</enabled>
>       </snapshots>
>     </pluginRepository>
>   </pluginRepositories>
> 
> -Tim
> 
> Chris Helck schrieb:
>> Hi,
>>
>> How can I redefine the central repository for specific profiles? I have
>> three profiles defined in my settings.xml: dev, qa, and cert. I want the
>> "dev" profile to use the default central repository, but I want the "qa"
>> and "cert" profiles to use specific (but different) in-house URLs. From
>> what I've read the preferred way of overriding the central repository is
>> to redirect it via the <mirror> tag in settings.xml. But I can't use
>> <mirrors/> at the <profile/> level, it only goes under <settings/>, so
>> the mirror ends up being a global redirect instead of a profile specific
>> redirect.
>>
>> Should I disable central completely:
>> <mirror>
>>   <id>Null Central</id>
>>   <name>Null</name>
>>   <url/>
>>   <mirrorOf>central</mirrorOf>
>> </mirror>
>>
>> And add http://repo1.maven.org/maven under a different repo id? The in
>> each <profile> I could define something lilke:
>> <repository>
>>   <id>my-central</id>
>>   ...
>> </repository>
>>
>> BTW: I'm using maven 2.0.4 on Ubuntu.
>>
>> Thanks,
>> Christopher Helck
>>
>>
>>
>> **********************************************************************
>> This communication and all information (including, but not limited to,
>>  market prices/levels and data) contained therein (the "Information") is
>>  for informational purposes only, is confidential, may be legally
>>  privileged and is the intellectual property of ICAP plc and its 
>> affiliates
>>  ("ICAP") or third parties. No confidentiality or privilege is waived or
>>  lost by any mistransmission. The Information is not, and should not
>>  be construed as, an offer, bid or solicitation in relation to any
>>  financial instrument or as an official confirmation of any transaction.
>>  The Information is not warranted, including, but not limited, as to
>>  completeness, timeliness or accuracy and is subject to change
>>  without notice. ICAP assumes no liability for use or misuse of the
>>  Information. All representations and warranties are expressly
>>  disclaimed. The Information does not necessarily reflect the views of
>>  ICAP. Access to the Information by anyone else other than the
>>  recipient is unauthorized and any disclosure, copying, distribution or
>>  any action taken or omitted to be taken in reliance on it is 
>> prohibited. If
>>  you receive this message in error, please immediately delete it and all
>>  copies of it from your system, destroy any hard copies of it and
>>  notify the sender.
>> **********************************************************************
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2: Need help with central repositories, and mirrors

Posted by Tim Kettler <ti...@udo.edu>.
Hi,

setting the mirror to an invalid url would certainly work but I imagine 
you would get tons of warnings about failed repository accesses since 
maven would still try download from the mirror.

What I would do instead is to just overwrite the definition of central 
in the qa and cert profiles like this:

   <repositories>
     <repository>
       <id>central</id>
       <name>Internal replacement for the central repository</name>
       <url>http://bla.com/repository</url>
       <releases>
         <enabled>true</enabled>
       </releases>
       <snapshots>
         <enabled>false</enabled>
       </snapshots>
     </repository>
   </repositories>

   <pluginRepositories>
     <pluginRepository>
       <id>central</id>
       <name>Internal replacement for the central repository</name>
       <url>http://bla.com/repository</url>
       <releases>
         <enabled>true</enabled>
       </releases>
       <snapshots>
         <enabled>false</enabled>
       </snapshots>
     </pluginRepository>
   </pluginRepositories>

-Tim

Chris Helck schrieb:
> Hi,
> 
> How can I redefine the central repository for specific profiles? I have
> three profiles defined in my settings.xml: dev, qa, and cert. I want the
> "dev" profile to use the default central repository, but I want the "qa"
> and "cert" profiles to use specific (but different) in-house URLs. From
> what I've read the preferred way of overriding the central repository is
> to redirect it via the <mirror> tag in settings.xml. But I can't use
> <mirrors/> at the <profile/> level, it only goes under <settings/>, so
> the mirror ends up being a global redirect instead of a profile specific
> redirect.
> 
> Should I disable central completely:
> <mirror>
>   <id>Null Central</id>
>   <name>Null</name>
>   <url/>
>   <mirrorOf>central</mirrorOf>
> </mirror>
> 
> And add http://repo1.maven.org/maven under a different repo id? The in
> each <profile> I could define something lilke:
> <repository>
>   <id>my-central</id>
>   ...
> </repository>
> 
> BTW: I'm using maven 2.0.4 on Ubuntu.
> 
> Thanks,
> Christopher Helck
> 
> 
> 
> **********************************************************************
> This communication and all information (including, but not limited to,
>  market prices/levels and data) contained therein (the "Information") is
>  for informational purposes only, is confidential, may be legally
>  privileged and is the intellectual property of ICAP plc and its affiliates
>  ("ICAP") or third parties. No confidentiality or privilege is waived or
>  lost by any mistransmission. The Information is not, and should not
>  be construed as, an offer, bid or solicitation in relation to any
>  financial instrument or as an official confirmation of any transaction.
>  The Information is not warranted, including, but not limited, as to
>  completeness, timeliness or accuracy and is subject to change
>  without notice. ICAP assumes no liability for use or misuse of the
>  Information. All representations and warranties are expressly
>  disclaimed. The Information does not necessarily reflect the views of
>  ICAP. Access to the Information by anyone else other than the
>  recipient is unauthorized and any disclosure, copying, distribution or
>  any action taken or omitted to be taken in reliance on it is prohibited. If
>  you receive this message in error, please immediately delete it and all
>  copies of it from your system, destroy any hard copies of it and
>  notify the sender.
> **********************************************************************
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org