本文整理汇总了Java中org.apache.ivy.Ivy.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Ivy.newInstance方法的具体用法?Java Ivy.newInstance怎么用?Java Ivy.newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.Ivy
的用法示例。
在下文中一共展示了Ivy.newInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Before
public void setUp()
throws Exception
{
resolver = createMock( Resolver.class );
deployer = createStrictMock( Deployer.class );
visitor = createMock( ReportVisitor.class );
IvyResolver ivyResolver = new IvyResolver();
ivyResolver.setResolver( resolver );
ivyResolver.setDeployer( deployer );
IvySettings settings = new IvySettings();
settings.addResolver( ivyResolver );
settings.setDefaultResolver( "XMvn" );
ivy = Ivy.newInstance( settings );
}
示例2: testLatestDependenciesNoDefaultResolver
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testLatestDependenciesNoDefaultResolver() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings-nodefaultresolver.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.4", "1.0.1"), "test", "install",
new InstallOptions());
assertTrue(new File("build/test/install/org1/mod1.4/ivy-1.0.1.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-2.0.jar").exists());
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.2.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.2.jar").exists());
}
示例3: testLatestDependenciesDummyDefaultResolver
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testLatestDependenciesDummyDefaultResolver() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings-dummydefaultresolver.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.4", "1.0.1"), "test", "install",
new InstallOptions());
assertTrue(new File("build/test/install/org1/mod1.4/ivy-1.0.1.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-2.0.jar").exists());
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.2.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.2.jar").exists());
}
示例4: getIvy
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
private Ivy getIvy() {
lock.lock();
try {
if (!cached.isEmpty()) {
return cached.removeFirst();
}
if (!messageAdapterAttached) {
Message.setDefaultLogger(new IvyLoggingAdaper());
messageAdapterAttached = true;
}
} finally {
lock.unlock();
}
return Ivy.newInstance(new IvySettings());
}
示例5: setupIvy
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
private void setupIvy() {
IvySettings ivySettings = new IvySettings();
try {
ivySettings.setVariable("common.build.dir", commonBuildDir.getAbsolutePath());
ivySettings.setVariable("ivy.exclude.types", "source|javadoc");
ivySettings.setBaseDir(commonBuildDir);
ivySettings.setDefaultConflictManager(new NoConflictManager());
ivy = Ivy.newInstance(ivySettings);
ivy.configure(ivySettingsFile);
} catch (Exception e) {
throw new BuildException("Exception reading " + ivySettingsFile.getPath() + ": " + e.toString(), e);
}
}
示例6: getDefaultIvy
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
private Ivy getDefaultIvy() {
if (defaultIvy == null) {
defaultIvy = Ivy.newInstance();
try {
defaultIvy.configureDefault();
} catch (Exception e) {
Message.debug(e);
// ???
}
}
return defaultIvy;
}
示例7: setUp
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
cache = new File("build/cache");
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
createCache();
deliverDir = new File("build/test/deliver");
deliverDir.mkdirs();
workDir = new File("build/test/work");
workDir.mkdirs();
ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
}
示例8: testNotTransitive
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testNotTransitive() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), ivy.getSettings()
.getDefaultResolver().getName(), "install",
new InstallOptions().setTransitive(false));
assertTrue(new File("build/test/install/org1/mod1.1/ivy-1.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-1.0.jar").exists());
assertFalse(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
assertFalse(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
}
示例9: setUp
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
TestHelper.createCache();
Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_INFO));
}
示例10: testListInMavenRepo
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testListInMavenRepo() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/m2/ivysettings.xml").toURI().toURL());
Map<String, Object> otherTokenValues = new HashMap<>();
otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "org.apache");
otherTokenValues.put(IvyPatternHelper.MODULE_KEY, "test-metadata");
String[] revs = ivy.listTokenValues(IvyPatternHelper.REVISION_KEY, otherTokenValues);
assertEquals(new HashSet<>(Arrays.asList("1.0", "1.1")),
new HashSet<>(Arrays.asList(revs)));
}
示例11: testListModulesWithExtraAttributes
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testListModulesWithExtraAttributes() throws ParseException, IOException {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/IVY-1128/ivysettings.xml"));
IvySettings settings = ivy.getSettings();
Map<String, String> extendedAttributes = new HashMap<>();
extendedAttributes.put("e:att1", "extraatt");
extendedAttributes.put("e:att2", "extraatt2");
ModuleRevisionId criteria = ModuleRevisionId.newInstance("test", "a", "*",
extendedAttributes);
ModuleRevisionId[] mrids = ivy.listModules(criteria,
settings.getMatcher(PatternMatcher.REGEXP));
assertEquals(2, mrids.length);
ModuleRevisionId mrid = mrids[0];
assertEquals("extraatt", mrid.getExtraAttribute("att1"));
Map<String, String> extraAttributes = mrid.getExtraAttributes();
assertEquals(2, extraAttributes.size());
assertTrue(extraAttributes.toString(), extraAttributes.keySet().contains("att1"));
assertTrue(extraAttributes.toString(), extraAttributes.keySet().contains("att2"));
Map<String, String> qualifiedExtraAttributes = mrid.getQualifiedExtraAttributes();
assertEquals(2, qualifiedExtraAttributes.size());
assertTrue(qualifiedExtraAttributes.toString(),
qualifiedExtraAttributes.keySet().contains("e:att1"));
assertTrue(qualifiedExtraAttributes.toString(),
qualifiedExtraAttributes.keySet().contains("e:att2"));
}
示例12: testSimple
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testSimple() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), ivy.getSettings()
.getDefaultResolver().getName(), "install", new InstallOptions());
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
}
示例13: configure
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
public Ivy configure() throws Exception {
boolean verbose = System.getProperty("verbose") != null;
boolean debug = System.getProperty("debug") != null;
HumanReadyLogger humanReadyLogger = new HumanReadyLogger();
IvySettings ivySettings = new IvySettings();
new SettingsParser(humanReadyLogger).parse(ivySettings, new File(framework, "framework/dependencies.yml"));
new SettingsParser(humanReadyLogger).parse(ivySettings, new File(application, "conf/dependencies.yml"));
ivySettings.setDefaultResolver("mavenCentral");
ivySettings.setDefaultUseOrigin(true);
PlayConflictManager conflictManager = new PlayConflictManager();
ivySettings.addConflictManager("playConflicts", conflictManager);
ivySettings.addConflictManager("defaultConflicts", conflictManager.deleguate);
ivySettings.setDefaultConflictManager(conflictManager);
Ivy ivy = Ivy.newInstance(ivySettings);
// Default ivy config see: http://play.lighthouseapp.com/projects/57987-play-framework/tickets/807
File ivyDefaultSettings = new File(userHome, ".ivy2/ivysettings.xml");
if(ivyDefaultSettings.exists()) {
ivy.configure(ivyDefaultSettings);
}
if (debug) {
ivy.getLoggerEngine().pushLogger(new DefaultMessageLogger(Message.MSG_DEBUG));
} else if (verbose) {
ivy.getLoggerEngine().pushLogger(new DefaultMessageLogger(Message.MSG_INFO));
} else {
logger = humanReadyLogger;
ivy.getLoggerEngine().setDefaultLogger(logger);
}
ivy.pushContext();
return ivy;
}
示例14: testNoValidate
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testNoValidate() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
ivy.install(ModuleRevisionId.newInstance("orgfailure", "modfailure", "1.0"), ivy
.getSettings().getDefaultResolver().getName(), "install",
new InstallOptions().setValidate(false));
assertTrue(new File("build/test/install/orgfailure/modfailure/ivy-1.0.xml").exists());
assertTrue(new File("build/test/install/orgfailure/modfailure/modfailure-1.0.jar").exists());
}
示例15: testDependencies
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testDependencies() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), ivy.getSettings()
.getDefaultResolver().getName(), "install", new InstallOptions());
assertTrue(new File("build/test/install/org1/mod1.1/ivy-1.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-1.0.jar").exists());
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
}