本文整理汇总了Java中org.apache.maven.settings.Server.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Server.getId方法的具体用法?Java Server.getId怎么用?Java Server.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.settings.Server
的用法示例。
在下文中一共展示了Server.getId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addServer
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
public MavenExecutionRequest addServer( Server server )
{
if ( server == null )
{
throw new IllegalArgumentException( "server missing" );
}
for ( Server p : getServers() )
{
if ( p.getId() != null && p.getId().equals( server.getId() ) )
{
return this;
}
}
getServers().add( server );
return this;
}
示例2: execute
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
/**
* Execute the mojo.
*
* @throws MojoExecutionException
*/
@Override
public void execute() throws MojoExecutionException {
Log log = getLog();
boolean debugEnabled = log.isDebugEnabled();
for (Server server : this.settings.getServers()) {
String settingsKey = server.getId();
String username = server.getUsername();
String password = server.getPassword();
String usernameProperty = settingsKey + "."
+ DEFAULT_USERNAME_PROPERTY_SUFFIX;
String passwordProperty = settingsKey + "."
+ DEFAULT_PASSWORD_PROPERTY_SUFFIX;
if (!project.getProperties().containsKey(usernameProperty))
project.getProperties().setProperty(usernameProperty, username);
if (!project.getProperties().containsKey(passwordProperty))
project.getProperties().setProperty(passwordProperty, password);
if (useSystemProperties) {
if (System.getProperty(usernameProperty) == null)
System.setProperty(usernameProperty, username);
if (System.getProperty(passwordProperty) == null)
System.setProperty(passwordProperty, password);
}
if (debugEnabled)
log.debug(String.format("username property '%s' is '%s'",
usernameProperty, username));
if (debugEnabled)
log.debug(String.format("password property '%s' is '%s'",
passwordProperty, password));
}
}