You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Erik Drolshammer <er...@gmail.com> on 2008/03/18 08:54:27 UTC

Advanced authentication with settings.xml

Hi!
I work on two projects which utilize Artifactory as build artifact 
manager. Both are used as proxies, so we want to make them both replace 
central, but not at the same time. I also deploy/release company 
internal artifacts to libs-releases/libs-snapshots to companyA's repo 
and to companyB's repo.
How can I implement this use case?

It seems to me that support for the servers element in a profile solves 
all my problems. Has such an idea been considered?

As a workaround I have tried creating two profiles in settings.xml and 
put properties i these. However, properties doesn't seem to be resolved 
neither within the properties element in the profile, nor in a server 
element.

E.g. in the following configuration none of the variables are resolved. 
(according to mvn help:effective-settings)

<settings>
   <servers>
     <server>
       <id>central</id>
       <username>${central.username}</username>
       <password>${central.password}</password>
     </server>
     <server>
       <id>libs-releases</id>
       <username>${libs-releases.username}</username>
       <password>${libs-releases.password}</password>
     </server>
     <server>
       <id>libs-snapshots</id>
       <username>${libs-snapshots.username}</username>
       <password>${libs-snapshots.password}</password>
     </server>
   </servers>
   <profiles>
     <profile>
       <id>A</id>
       <activation>
         <activeByDefault>true</activeByDefault>
       </activation>
       <properties>
         <a.username>user</a.username>
         <a.password>pwd</a.password>

         <central.username>${a.username}</central.username>
         <central.password>${a.password}</central.password>

         <libs-releases.username>${a.username}</libs-releases.username>
         <libs-releases.password>${a.password}</libs-releases.password> 


         <libs-snapshots.username>${a.username}</libs-snapshots.username>
         <libs-snapshots.password>${a.password}</libs-snapshots.password>
       </properties>
   </profile>
   </profiles>
</settings>


Currently I manually change the settings.xml file, but this is very 
cumbersome. I could of course use multiple settings.xml files, but this 
is not an enticing solution either.

-- 
Regards
Erik Drolshammer

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


Re: Advanced authentication with settings.xml

Posted by Erik Drolshammer <er...@fjas.no>.
Brian E. Fox wrote:
> I don't follow what you're actually trying to do. Are you trying to
> switch between two artifactories/mirrors or change where you deploy to?
> (or both?) 

Both. I want to switch between multiple artifactories and I want the 
repos in these to follow the same naming conventions. I thus need to 
switch which artifactory override central at any given time and I need 
to provide username and passwords for two repos called "libs-releases".



-- 
Regards
Erik Drolshammer

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


RE: Advanced authentication with settings.xml

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
I don't follow what you're actually trying to do. Are you trying to
switch between two artifactories/mirrors or change where you deploy to?
(or both?) 

-----Original Message-----
From: Erik Drolshammer [mailto:erik.drolshammer@gmail.com] 
Sent: Tuesday, March 18, 2008 3:54 AM
To: Maven Developers List
Subject: Advanced authentication with settings.xml

Hi!
I work on two projects which utilize Artifactory as build artifact 
manager. Both are used as proxies, so we want to make them both replace 
central, but not at the same time. I also deploy/release company 
internal artifacts to libs-releases/libs-snapshots to companyA's repo 
and to companyB's repo.
How can I implement this use case?

It seems to me that support for the servers element in a profile solves 
all my problems. Has such an idea been considered?

As a workaround I have tried creating two profiles in settings.xml and 
put properties i these. However, properties doesn't seem to be resolved 
neither within the properties element in the profile, nor in a server 
element.

E.g. in the following configuration none of the variables are resolved. 
(according to mvn help:effective-settings)

<settings>
   <servers>
     <server>
       <id>central</id>
       <username>${central.username}</username>
       <password>${central.password}</password>
     </server>
     <server>
       <id>libs-releases</id>
       <username>${libs-releases.username}</username>
       <password>${libs-releases.password}</password>
     </server>
     <server>
       <id>libs-snapshots</id>
       <username>${libs-snapshots.username}</username>
       <password>${libs-snapshots.password}</password>
     </server>
   </servers>
   <profiles>
     <profile>
       <id>A</id>
       <activation>
         <activeByDefault>true</activeByDefault>
       </activation>
       <properties>
         <a.username>user</a.username>
         <a.password>pwd</a.password>

         <central.username>${a.username}</central.username>
         <central.password>${a.password}</central.password>

         <libs-releases.username>${a.username}</libs-releases.username>
         <libs-releases.password>${a.password}</libs-releases.password> 


 
<libs-snapshots.username>${a.username}</libs-snapshots.username>
 
<libs-snapshots.password>${a.password}</libs-snapshots.password>
       </properties>
   </profile>
   </profiles>
</settings>


Currently I manually change the settings.xml file, but this is very 
cumbersome. I could of course use multiple settings.xml files, but this 
is not an enticing solution either.

-- 
Regards
Erik Drolshammer

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


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