本文整理汇总了Java中org.apache.ivy.Ivy.install方法的典型用法代码示例。如果您正苦于以下问题:Java Ivy.install方法的具体用法?Java Ivy.install怎么用?Java Ivy.install使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.Ivy
的用法示例。
在下文中一共展示了Ivy.install方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMaven
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testMaven() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
@SuppressWarnings("unused")
ResolveReport rr = ivy.install(ModuleRevisionId.newInstance("org.apache", "test", "1.0"),
ivy.getSettings().getDefaultResolver().getName(), "install", new InstallOptions());
assertTrue(new File("build/test/install/org.apache/test/ivy-1.0.xml").exists());
assertTrue(new File("build/test/install/org.apache/test/test-1.0.jar").exists());
// the original descriptor is not installed
assertFalse(new File("build/test/install/org.apache/test/test-1.0.pom").exists());
ivy.install(ModuleRevisionId.newInstance("org.apache", "test", "1.0"), ivy.getSettings()
.getDefaultResolver().getName(), "install", new InstallOptions()
.setInstallOriginalMetadata(true).setOverwrite(true));
// the original descriptor is installed now, too
assertTrue(new File("build/test/install/org.apache/test/test-1.0.pom").exists());
}
示例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: testRegexpMatcher
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testRegexpMatcher() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", ".*", ".*"), "1", "install",
new InstallOptions().setMatcherName(PatternMatcher.REGEXP).setOverwrite(true));
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.1/ivy-1.1.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-1.1.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());
// mod1.3 is split because Ivy thinks there are two versions of the module:
// this is the normal behaviour in this case
assertTrue(new File("build/test/install/org1/mod1.3/ivy-B-3.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.3/ivy-A-3.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.3/mod1.3-A-3.0.jar").exists());
assertTrue(new File("build/test/install/org1/mod1.3/mod1.3-B-3.0.jar").exists());
assertTrue(new File("build/test/install/org1/mod1.4/ivy-1.0.1.xml").exists());
}
示例5: 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());
}
示例6: testValidate
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testValidate() 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());
assertFalse(new File("build/test/install/orgfailure/modfailure/ivy-1.0.xml").exists());
assertFalse(new File("build/test/install/orgfailure/modfailure/modfailure-1.0.jar")
.exists());
}
示例7: 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());
}
示例8: testSimpleWithoutDefaultResolver
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
@Test
public void testSimpleWithoutDefaultResolver() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings-nodefaultresolver.xml"));
ivy.install(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), "test", "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());
}
示例9: 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());
}
示例10: 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());
}
示例11: doExecute
import org.apache.ivy.Ivy; //导入方法依赖的package包/类
public void doExecute() throws BuildException {
Ivy ivy = getIvyInstance();
IvySettings settings = ivy.getSettings();
if (organisation == null) {
throw new BuildException("no organisation provided for ivy publish task: "
+ "It can either be set explicitly via the attribute 'organisation' "
+ "or via 'ivy.organisation' property or a prior call to <resolve/>");
}
if (module == null) {
if (PatternMatcher.EXACT.equals(matcher)) {
throw new BuildException("no module name provided for ivy publish task: "
+ "It can either be set explicitly via the attribute 'module' "
+ "or via 'ivy.module' property or a prior call to <resolve/>");
}
module = PatternMatcher.ANY_EXPRESSION;
}
if (revision == null) {
if (PatternMatcher.EXACT.equals(matcher)) {
throw new BuildException("no module revision provided for ivy publish task: "
+ "It can either be set explicitly via the attribute 'revision' "
+ "or via 'ivy.revision' property or a prior call to <resolve/>");
}
revision = PatternMatcher.ANY_EXPRESSION;
}
if (branch == null) {
if (PatternMatcher.EXACT.equals(matcher)) {
branch = settings.getDefaultBranch(ModuleId.newInstance(organisation, module));
} else {
branch = PatternMatcher.ANY_EXPRESSION;
}
}
if (from == null) {
throw new BuildException(
"no from resolver name: please provide it through parameter 'from'");
}
if (to == null) {
throw new BuildException(
"no to resolver name: please provide it through parameter 'to'");
}
ModuleRevisionId mrid = ModuleRevisionId
.newInstance(organisation, module, branch, revision);
ResolveReport report;
try {
report = ivy.install(
mrid,
from,
to,
new InstallOptions().setTransitive(transitive).setValidate(doValidate(settings))
.setOverwrite(overwrite).setConfs(conf.split(","))
.setArtifactFilter(FilterHelper.getArtifactTypeFilter(type))
.setMatcherName(matcher)
.setInstallOriginalMetadata(installOriginalMetadata));
} catch (Exception e) {
throw new BuildException("impossible to install " + mrid + ": " + e, e);
}
if (report.hasError() && isHaltonfailure()) {
throw new BuildException(
"Problem happened while installing modules - see output for details");
}
}