本文整理匯總了Java中org.apache.maven.execution.MavenSession.getSettings方法的典型用法代碼示例。如果您正苦於以下問題:Java MavenSession.getSettings方法的具體用法?Java MavenSession.getSettings怎麽用?Java MavenSession.getSettings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.maven.execution.MavenSession
的用法示例。
在下文中一共展示了MavenSession.getSettings方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getProxyConfig
import org.apache.maven.execution.MavenSession; //導入方法依賴的package包/類
static ProxyConfig getProxyConfig(MavenSession mavenSession) {
if (
mavenSession == null ||
mavenSession.getSettings() == null ||
mavenSession.getSettings().getActiveProxy() == null ||
!mavenSession.getSettings().getActiveProxy().isActive()
) {
return null;
} else {
Proxy mavenProxy = mavenSession.getSettings().getActiveProxy();
return new ProxyConfig(
mavenProxy.getProtocol(),
mavenProxy.getHost(),
mavenProxy.getPort(),
mavenProxy.getUsername(),
mavenProxy.getPassword());
}
}
示例2: getProxyConfig
import org.apache.maven.execution.MavenSession; //導入方法依賴的package包/類
static ProxyConfig getProxyConfig(MavenSession mavenSession, SettingsDecrypter decrypter) {
if (mavenSession == null ||
mavenSession.getSettings() == null ||
mavenSession.getSettings().getProxies() == null ||
mavenSession.getSettings().getProxies().isEmpty()) {
return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList());
} else {
final List<Proxy> mavenProxies = mavenSession.getSettings().getProxies();
final List<ProxyConfig.Proxy> proxies = new ArrayList<ProxyConfig.Proxy>(mavenProxies.size());
for (Proxy mavenProxy : mavenProxies) {
if (mavenProxy.isActive()) {
mavenProxy = decryptProxy(mavenProxy, decrypter);
proxies.add(new ProxyConfig.Proxy(mavenProxy.getId(), mavenProxy.getProtocol(), mavenProxy.getHost(),
mavenProxy.getPort(), mavenProxy.getUsername(), mavenProxy.getPassword(), mavenProxy.getNonProxyHosts()));
}
}
LOGGER.info("Found proxies: {}", proxies);
return new ProxyConfig(proxies);
}
}
示例3: getProxyConfig
import org.apache.maven.execution.MavenSession; //導入方法依賴的package包/類
public static ProxyConfig getProxyConfig(MavenSession mavenSession, SettingsDecrypter decrypter) {
if (mavenSession == null ||
mavenSession.getSettings() == null ||
mavenSession.getSettings().getProxies() == null ||
mavenSession.getSettings().getProxies().isEmpty()) {
return new ProxyConfig(Collections.<ProxyConfig.Proxy>emptyList());
} else {
final List<Proxy> mavenProxies = mavenSession.getSettings().getProxies();
final List<ProxyConfig.Proxy> proxies = new ArrayList<>(mavenProxies.size());
for (Proxy mavenProxy : mavenProxies) {
if (mavenProxy.isActive()) {
mavenProxy = decryptProxy(mavenProxy, decrypter);
proxies.add(new ProxyConfig.Proxy(mavenProxy.getId(), mavenProxy.getProtocol(), mavenProxy.getHost(),
mavenProxy.getPort(), mavenProxy.getUsername(), mavenProxy.getPassword(), mavenProxy.getNonProxyHosts()));
}
}
return new ProxyConfig(proxies);
}
}
示例4: getServerSettings
import org.apache.maven.execution.MavenSession; //導入方法依賴的package包/類
public Server getServerSettings(String serverId) {
MavenSession mavenSession = getMavenSession();
Settings settings = mavenSession.getSettings();
Server server = settings.getServer(serverId);
return server;
}