use of org.apache.ivy.util.PropertiesFile in project ant-ivy by apache.
the class Main method initSettings.
private static IvySettings initSettings(CommandLine line, Ivy ivy) throws java.text.ParseException, IOException, ParseException {
IvySettings settings = ivy.getSettings();
settings.addAllVariables(System.getProperties());
if (line.hasOption("properties")) {
settings.addAllVariables(new PropertiesFile(new File(line.getOptionValue("properties")), "additional properties"));
}
if (line.hasOption("m2compatible")) {
settings.setVariable("ivy.default.configuration.m2compatible", "true");
}
configureURLHandler(line.getOptionValue("realm", null), line.getOptionValue("host", null), line.getOptionValue("username", null), line.getOptionValue("passwd", null));
String settingsPath = line.getOptionValue("settings", "");
if ("".equals(settingsPath)) {
settingsPath = line.getOptionValue("conf", "");
if (!"".equals(settingsPath)) {
Message.deprecated("-conf is deprecated, use -settings instead");
}
}
if ("".equals(settingsPath)) {
ivy.configureDefault();
} else {
File conffile = new File(settingsPath);
if (!conffile.exists()) {
error("ivy configuration file not found: " + conffile);
} else if (conffile.isDirectory()) {
error("ivy configuration file is not a file: " + conffile);
}
ivy.configure(conffile);
}
return settings;
}
use of org.apache.ivy.util.PropertiesFile in project ant-ivy by apache.
the class DefaultRepositoryCacheManager method saveResolver.
/**
* Saves the information of which resolver was used to resolve a md, so that this info can be
* retrieve later (even after a jvm restart) by getSavedResolverName(ModuleDescriptor md)
*
* @param md
* the module descriptor resolved
* @param name
* resolver name
*/
private void saveResolver(ModuleDescriptor md, String name) {
// should always be called with a lock on module metadata artifact
PropertiesFile cdf = getCachedDataFile(md);
cdf.setProperty("resolver", name);
cdf.save();
}
use of org.apache.ivy.util.PropertiesFile in project ant-ivy by apache.
the class DefaultRepositoryCacheManager method saveResolvedRevision.
public void saveResolvedRevision(String resolverName, ModuleRevisionId mrid, String revision) {
if (!lockMetadataArtifact(mrid)) {
Message.error("impossible to acquire lock for " + mrid);
return;
}
try {
PropertiesFile cachedResolvedRevision;
if (resolverName == null) {
cachedResolvedRevision = getCachedDataFile(mrid);
} else {
cachedResolvedRevision = getCachedDataFile(resolverName, mrid);
}
cachedResolvedRevision.setProperty("resolved.time", String.valueOf(System.currentTimeMillis()));
cachedResolvedRevision.setProperty("resolved.revision", revision);
if (resolverName != null) {
cachedResolvedRevision.setProperty("resolver", resolverName);
}
cachedResolvedRevision.save();
} finally {
unlockMetadataArtifact(mrid);
}
}
Aggregations