use of io.fabric8.maven.util.MavenConfigurationImpl in project fabric8 by jboss-fuse.
the class MavenProxyServletSupportTest method createResolver.
private MavenResolver createResolver(String localRepo, List<String> remoteRepos, String proxyProtocol, String proxyHost, int proxyPort, String proxyUsername, String proxyPassword, String proxyNonProxyHosts) {
Hashtable<String, String> props = new Hashtable<>();
props.put("localRepository", localRepo);
if (remoteRepos != null) {
props.put("repositories", join(remoteRepos, ","));
}
MavenConfigurationImpl config = new MavenConfigurationImpl(new DictionaryPropertyResolver(props), null);
if (proxyProtocol != null) {
Proxy proxy = new Proxy();
proxy.setProtocol(proxyProtocol);
proxy.setHost(proxyHost);
proxy.setPort(proxyPort);
proxy.setUsername(proxyUsername);
proxy.setPassword(proxyPassword);
proxy.setNonProxyHosts(proxyNonProxyHosts);
config.getSettings().addProxy(proxy);
}
return new AetherBasedResolver(config);
}
use of io.fabric8.maven.util.MavenConfigurationImpl in project fabric8 by jboss-fuse.
the class ProfileWatcherImpl method retrieveMavenConfiguration.
protected MavenConfiguration retrieveMavenConfiguration() {
MavenConfiguration mavenConfiguration = null;
try {
Configuration configuration = configurationAdmin.get().getConfiguration("org.ops4j.pax.url.mvn");
if (configuration != null) {
Dictionary dictonary = configuration.getProperties();
if (dictonary != null) {
DictionaryPropertyResolver resolver = new DictionaryPropertyResolver(dictonary);
mavenConfiguration = new MavenConfigurationImpl(resolver, "org.ops4j.pax.url.mvn");
}
}
} catch (IOException e) {
LOG.error("Error retrieving maven configuration", e);
}
return mavenConfiguration;
}
use of io.fabric8.maven.util.MavenConfigurationImpl in project fabric8 by jboss-fuse.
the class Log4jLogQuery method loadCoords.
protected String loadCoords(String coords, String filePath, String classifier) throws IOException {
String[] split = coords.split("/");
if (split != null && split.length > 2) {
String groupId = split[0];
String artifactId = split[1];
String version = split[2];
if (resolver == null) {
Properties defaultProperties = getDefaultProperties();
Properties systemProperties = System.getProperties();
if (config == null) {
Properties combined = new Properties();
combined.putAll(defaultProperties);
combined.putAll(systemProperties);
if (properties != null) {
combined.putAll(properties);
}
config = new MavenConfigurationImpl(new PropertiesPropertyResolver(combined), ServiceConstants.PID);
}
resolver = new AetherBasedResolver(config);
}
File file = resolver.resolveFile(groupId, artifactId, classifier, "jar", version);
if (file.exists() && file.isFile()) {
if (isRoot(filePath)) {
return jarIndex(file);
}
String fileUri = file.toURI().toString();
URL url = new URL("jar:" + fileUri + "!" + filePath);
return loadString(url);
}
}
return null;
}
use of io.fabric8.maven.util.MavenConfigurationImpl in project fabric8 by jboss-fuse.
the class AetherTimeoutTest method basicMavenConfiguration.
private MavenConfigurationImpl basicMavenConfiguration(int timeoutInMs) {
Properties properties = new Properties();
properties.setProperty("pid.localRepository", "target/" + UUID.randomUUID().toString());
properties.setProperty("pid.timeout", Integer.toString(timeoutInMs));
properties.setProperty("pid.globalChecksumPolicy", "ignore");
properties.setProperty("pid.connection.retryCount", "0");
return new MavenConfigurationImpl(new PropertiesPropertyResolver(properties), "pid");
}
use of io.fabric8.maven.util.MavenConfigurationImpl in project fabric8 by jboss-fuse.
the class AetherTimeoutTest method basicMavenConfigurationWithTwoTimeouts.
private MavenConfigurationImpl basicMavenConfigurationWithTwoTimeouts(int readTimeoutInMs, int connectTimeoutInMs) {
Properties properties = new Properties();
properties.setProperty("pid.localRepository", "target/" + UUID.randomUUID().toString());
properties.setProperty("pid.timeout", Integer.toString(readTimeoutInMs));
properties.setProperty("pid.socket.connectionTimeout", Integer.toString(connectTimeoutInMs));
properties.setProperty("pid.globalChecksumPolicy", "ignore");
properties.setProperty("pid.connection.retryCount", "0");
return new MavenConfigurationImpl(new PropertiesPropertyResolver(properties), "pid");
}
Aggregations