You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ben Tatham <be...@nanometrics.ca> on 2010/01/29 14:20:21 UTC

Access to server settings from settings.xml

Hi, 

Is it possible to access a server username/password (even/especially when encrypted) from an Ant Mojo and/or antrun script? 

If you know how to do it from a Java Mojo, I would take that too. 

I would like to be able to use it to ssh to other servers where we have some cross-compilers installed, etc, and currently we are forcing our developers to set our own properties in settings.xml, which does not support encryption. 

I have tried things like this (following the pattern from http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide) , but of course, the server <id> must get in there somehow, I assume. 
${settings.servers.id.username} ${settings.server.id.username} etc etc to no avail. 

Thanks, 
Ben 

Re: Access to server settings from settings.xml

Posted by Ben Tatham <be...@nanometrics.ca>.
To answer my own question for groovy, I found this: 

http://weblogs.java.net/blog/2009/08/10/getting-most-out-maven-settingsxml-file 

which explains doing this: 
def server = settings.servers.find{ it.id.equals('dbserver') } 
But does anyone know how to do it in ant? 

Thanks, 
Ben 

----- "Ben Tatham" <be...@nanometrics.ca> wrote: 
> Hi, 
> 
> Is it possible to access a server username/password (even/especially when encrypted) from an Ant Mojo and/or antrun script? 
> 
> If you know how to do it from a Java Mojo, I would take that too. 
> 
> I would like to be able to use it to ssh to other servers where we have some cross-compilers installed, etc, and currently we are forcing our developers to set our own properties in settings.xml, which does not support encryption. 
> 
> I have tried things like this (following the pattern from http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide) , but of course, the server <id> must get in there somehow, I assume. 
> ${settings.servers.id.username} ${settings.server.id.username} etc etc to no avail. 
> 
> Thanks, 
> Ben