本文整理汇总了Java中org.apache.ivy.core.IvyPatternHelper类的典型用法代码示例。如果您正苦于以下问题:Java IvyPatternHelper类的具体用法?Java IvyPatternHelper怎么用?Java IvyPatternHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IvyPatternHelper类属于org.apache.ivy.core包,在下文中一共展示了IvyPatternHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getOutputPattern
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
private String getOutputPattern(String conf, String ext) {
if (mRevId == null) {
ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
XmlReportParser parser = new XmlReportParser();
File reportFile = cacheMgr.getConfigurationResolveReportInCache(resolveId, conf);
try {
parser.parse(reportFile);
} catch (ParseException e) {
throw new BuildException("Error occurred while parsing reportfile '"
+ reportFile.getAbsolutePath() + "'", e);
}
// get the resolve module
mRevId = parser.getResolvedModule();
}
return IvyPatternHelper.substitute(outputpattern, mRevId.getOrganisation(),
mRevId.getName(), mRevId.getRevision(), "", "", ext, conf,
mRevId.getQualifiedExtraAttributes(), null);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:23,代码来源:IvyReport.java
示例2: doExecute
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
public void doExecute() throws BuildException {
prepareAndCheck();
try {
ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
String resolveId = getResolveId();
if (resolveId == null) {
resolveId = ResolveOptions.getDefaultResolveId(getResolvedModuleId());
}
XmlReportParser parser = new XmlReportParser();
for (String conf : splitToArray(getConf())) {
File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, conf);
parser.parse(report);
for (Artifact artifact : parser.getArtifacts()) {
String name = IvyPatternHelper.substitute(getSettings().substitute(getName()),
artifact, conf);
String value = IvyPatternHelper.substitute(
getSettings().substitute(getValue()), artifact, conf);
setProperty(name, value);
}
}
} catch (Exception ex) {
throw new BuildException("impossible to add artifact properties: " + ex, ex);
}
}
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:IvyArtifactProperty.java
示例3: analyse
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
public void analyse(String pattern, DependencyAnalyser depAnalyser) {
JarModuleFinder finder = new JarModuleFinder(pattern);
ModuleDescriptor[] mds = depAnalyser.analyze(finder.findJarModules());
Message.info("found " + mds.length + " modules");
for (ModuleDescriptor md : mds) {
File ivyFile = new File(IvyPatternHelper.substitute(
pattern,
DefaultArtifact.newIvyArtifact(md.getModuleRevisionId(),
md.getPublicationDate())));
try {
Message.info("generating " + ivyFile);
XmlModuleDescriptorWriter.write(md, ivyFile);
} catch (IOException e) {
Message.debug(e);
}
}
}
开发者ID:apache,项目名称:ant-ivy,代码行数:18,代码来源:RepositoryAnalyser.java
示例4: findJarModules
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
public JarModule[] findJarModules() {
List<JarModule> ret = new ArrayList<>();
URLLister lister = new FileURLLister();
try {
for (String org : ResolverHelper.listTokenValues(lister, pattern, "organisation")) {
String orgPattern = IvyPatternHelper.substituteToken(pattern,
IvyPatternHelper.ORGANISATION_KEY, org);
for (String module : ResolverHelper.listTokenValues(lister, orgPattern, "module")) {
String modPattern = IvyPatternHelper.substituteToken(orgPattern,
IvyPatternHelper.MODULE_KEY, module);
for (String rev : ResolverHelper.listTokenValues(lister, modPattern, "revision")) {
File jar = new File(IvyPatternHelper.substitute(filePattern, org,
module, rev, module, "jar", "jar"));
if (jar.exists()) {
ret.add(new JarModule(ModuleRevisionId.newInstance(org, module, rev), jar));
}
}
}
}
} catch (Exception e) {
Message.debug(e);
// TODO: handle exception
}
return ret.toArray(new JarModule[ret.size()]);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:JarModuleFinder.java
示例5: ModuleRevisionId
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
private ModuleRevisionId(ModuleId moduleId, String branch, String revision,
Map<String, String> extraAttributes, boolean replaceNullBranchWithDefault) {
super(null, extraAttributes);
this.moduleId = moduleId;
IvyContext context = IvyContext.getContext();
this.branch = (replaceNullBranchWithDefault && branch == null)
// we test if there's already an Ivy instance loaded, to avoid loading a default one
// just to get the default branch
? (context.peekIvy() == null ? null : context.getSettings().getDefaultBranch(moduleId))
: branch;
this.revision = revision == null ? Ivy.getWorkingRevision() : normalizeRevision(revision);
setStandardAttribute(IvyPatternHelper.ORGANISATION_KEY, this.moduleId.getOrganisation());
setStandardAttribute(IvyPatternHelper.MODULE_KEY, this.moduleId.getName());
setStandardAttribute(IvyPatternHelper.BRANCH_KEY, this.branch);
setStandardAttribute(IvyPatternHelper.REVISION_KEY, this.revision);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:17,代码来源:ModuleRevisionId.java
示例6: listModuleEntries
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
public ModuleEntry[] listModuleEntries(OrganisationEntry org) {
Set<ModuleEntry> entries = new HashSet<>();
Map<String, Object> tokenValues = new HashMap<>();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org.getOrganisation());
for (DependencyResolver resolver : settings.getResolvers()) {
Map<String, String>[] modules = resolver.listTokenValues(
new String[] {IvyPatternHelper.MODULE_KEY}, tokenValues);
for (Map<String, String> me : modules) {
String module = me.get(IvyPatternHelper.MODULE_KEY);
entries.add(new ModuleEntry(org, module));
}
}
return entries.toArray(new ModuleEntry[entries.size()]);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:18,代码来源:SearchEngine.java
示例7: listModules
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
public String[] listModules(String org) {
Set<String> entries = new HashSet<>();
Map<String, Object> tokenValues = new HashMap<>();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
for (DependencyResolver resolver : settings.getResolvers()) {
Map<String, String>[] modules = resolver.listTokenValues(
new String[] {IvyPatternHelper.MODULE_KEY}, tokenValues);
for (Map<String, String> module : modules) {
entries.add(module.get(IvyPatternHelper.MODULE_KEY));
}
}
return entries.toArray(new String[entries.size()]);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:17,代码来源:SearchEngine.java
示例8: listRevisionEntries
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
public RevisionEntry[] listRevisionEntries(ModuleEntry module) {
Set<RevisionEntry> entries = new HashSet<>();
Map<String, Object> tokenValues = new HashMap<>();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, module.getOrganisation());
tokenValues.put(IvyPatternHelper.MODULE_KEY, module.getModule());
for (DependencyResolver resolver : settings.getResolvers()) {
Map<String, String>[] revisions = resolver.listTokenValues(
new String[] {IvyPatternHelper.REVISION_KEY}, tokenValues);
for (Map<String, String> revision : revisions) {
entries.add(new RevisionEntry(module, revision.get(IvyPatternHelper.REVISION_KEY)));
}
}
return entries.toArray(new RevisionEntry[entries.size()]);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:18,代码来源:SearchEngine.java
示例9: listRevisions
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
public String[] listRevisions(String org, String module) {
Set<String> entries = new HashSet<>();
Map<String, Object> tokenValues = new HashMap<>();
tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
tokenValues.put(IvyPatternHelper.MODULE_KEY, module);
for (DependencyResolver resolver : settings.getResolvers()) {
Map<String, String>[] revisions = resolver.listTokenValues(
new String[] {IvyPatternHelper.REVISION_KEY}, tokenValues);
for (Map<String, String> revision : revisions) {
entries.add(revision.get(IvyPatternHelper.REVISION_KEY));
}
}
return entries.toArray(new String[entries.size()]);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:18,代码来源:SearchEngine.java
示例10: getPatternMatcher
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
public Matcher getPatternMatcher(ModuleRevisionId askedMrid) {
String revision = askedMrid.getRevision();
List<String> args = split(getArgs());
List<String> argValues = getRevisionArgs(revision);
if (args.size() != argValues.size()) {
return new NoMatchMatcher();
}
Map<String, String> variables = new HashMap<>();
for (String arg : args) {
variables.put(arg, argValues.get(args.indexOf(arg)));
}
String pattern = getPattern();
pattern = IvyPatternHelper.substituteVariables(pattern, variables);
PatternMatcher pMatcher = IvyContext.getContext().getSettings().getMatcher(matcher);
return pMatcher.getMatcher(pattern);
}
开发者ID:apache,项目名称:ant-ivy,代码行数:22,代码来源:Match.java
示例11: findDynamicResourceUsingPattern
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
private ResolvedResource findDynamicResourceUsingPattern(ResourceMDParser rmdparser,
ModuleRevisionId mrid, String pattern, Artifact artifact, Date date) {
String name = getName();
logAttempt(IvyPatternHelper.substitute(
pattern,
ModuleRevisionId.newInstance(mrid,
IvyPatternHelper.getTokenString(IvyPatternHelper.REVISION_KEY)), artifact));
ResolvedResource[] rress = listResources(repository, mrid, pattern, artifact);
if (rress == null) {
Message.debug("\t" + name + ": unable to list resources for " + mrid + ": pattern="
+ pattern);
return null;
} else {
ResolvedResource found = findResource(rress, rmdparser, mrid, date);
if (found == null) {
Message.debug("\t" + name + ": no resource found for " + mrid + ": pattern="
+ pattern);
}
return found;
}
}
开发者ID:apache,项目名称:ant-ivy,代码行数:22,代码来源:RepositoryResolver.java
示例12: testInline
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
@Test
public void testInline() {
// we first resolve another ivy file
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
resolve.execute();
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
// then we resolve a dependency directly
retrieve.setOrganisation("org1");
retrieve.setModule("mod1.2");
retrieve.setRevision("2.0");
retrieve.setInline(true);
retrieve.execute();
assertTrue(new File(IvyPatternHelper.substitute(RETRIEVE_PATTERN, "org1", "mod1.2", "2.0",
"mod1.2", "jar", "jar")).exists());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:20,代码来源:IvyRetrieveTest.java
示例13: testWithAPreviousResolve
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
@Test
public void testWithAPreviousResolve() {
// first we do a resolve in another project
Project project = TestHelper.newProject();
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
resolve.execute();
// then we do a retrieve with the correct module information
retrieve.setOrganisation("apache");
retrieve.setModule("resolve-simple");
retrieve.setConf("default");
retrieve.execute();
assertTrue(new File(IvyPatternHelper.substitute(RETRIEVE_PATTERN, "org1", "mod1.2", "2.0",
"mod1.2", "jar", "jar")).exists());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:20,代码来源:IvyRetrieveTest.java
示例14: testWithAPreviousResolveAndResolveId
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
@Test
public void testWithAPreviousResolveAndResolveId() {
// first we do a resolve in another project
Project project = TestHelper.newProject();
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
resolve.setResolveId("testWithAPreviousResolveAndResolveId");
resolve.execute();
// then we do a retrieve with the correct module information
retrieve.setOrganisation("apache");
retrieve.setModule("resolve-simple");
retrieve.setConf("default");
retrieve.setResolveId("testWithAPreviousResolveAndResolveId");
retrieve.execute();
assertTrue(new File(IvyPatternHelper.substitute(RETRIEVE_PATTERN, "org1", "mod1.2", "2.0",
"mod1.2", "jar", "jar")).exists());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:22,代码来源:IvyRetrieveTest.java
示例15: testUseOrigin
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
/**
* Test case for IVY-304.
*
* @see <a href="https://issues.apache.org/jira/browse/IVY-304">IVY-304</a>
*/
@Test
public void testUseOrigin() {
// first we do a resolve with useOrigin=true in another project
Project project = TestHelper.newProject();
project.init();
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
IvyResolve resolve = new IvyResolve();
resolve.setProject(project);
resolve.setUseOrigin(true);
resolve.execute();
// then we do a retrieve with the correct module information and useOrigin=false
retrieve.setOrganisation("apache");
retrieve.setModule("resolve-simple");
retrieve.setConf("default");
retrieve.setUseOrigin(false);
retrieve.execute();
assertTrue(new File(IvyPatternHelper.substitute(RETRIEVE_PATTERN, "org1", "mod1.2", "2.0",
"mod1.2", "jar", "jar")).exists());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:28,代码来源:IvyRetrieveTest.java
示例16: testUseOriginWithIvyPattern
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
@Test
public void testUseOriginWithIvyPattern() {
// mod2.5 depends on virtual mod2.3 which depends on mod2.1 which depends on mod1.1 which
// depends on mod1.2
project.setProperty("ivy.dep.file", "test/repositories/1/org2/mod2.5/ivys/ivy-0.6.1.xml");
String ivyPattern = IVY_RETRIEVE_PATTERN;
retrieve.setIvypattern(ivyPattern);
retrieve.setUseOrigin(true);
retrieve.execute();
assertTrue(new File(IvyPatternHelper.substitute(ivyPattern, "org2", "mod2.3", "0.4.1",
"ivy", "ivy", "xml")).exists());
assertTrue(new File(IvyPatternHelper.substitute(ivyPattern, "org2", "mod2.1", "0.3", "ivy",
"ivy", "xml")).exists());
assertTrue(new File(IvyPatternHelper.substitute(ivyPattern, "org1", "mod1.1", "1.0", "ivy",
"ivy", "xml")).exists());
assertFalse(new File(IvyPatternHelper.substitute(ivyPattern, "org1", "mod1.2", "2.0",
"ivy", "ivy", "xml")).exists());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:22,代码来源:IvyRetrieveTest.java
示例17: testCustomIvyPattern
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
@Test
public void testCustomIvyPattern() {
// mod2.5 depends on virtual mod2.3 which depends on mod2.1 which depends on mod1.1 which
// depends on mod1.2
project.setProperty("ivy.dep.file", "test/repositories/1/org2/mod2.5/ivys/ivy-0.6.1.xml");
String ivyPattern = IVY_RETRIEVE_PATTERN;
retrieve.setIvypattern(ivyPattern);
retrieve.execute();
assertTrue(new File(IvyPatternHelper.substitute(ivyPattern, "org2", "mod2.3", "0.4.1",
"ivy", "ivy", "xml")).exists());
assertTrue(new File(IvyPatternHelper.substitute(ivyPattern, "org2", "mod2.1", "0.3", "ivy",
"ivy", "xml")).exists());
assertTrue(new File(IvyPatternHelper.substitute(ivyPattern, "org1", "mod1.1", "1.0", "ivy",
"ivy", "xml")).exists());
assertFalse(new File(IvyPatternHelper.substitute(ivyPattern, "org1", "mod1.2", "2.0",
"ivy", "ivy", "xml")).exists());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:IvyRetrieveTest.java
示例18: testCustomIvyPatternWithConf
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
@Test
public void testCustomIvyPatternWithConf() {
project.setProperty("ivy.dep.file", "test/repositories/1/org6/mod6.2/ivys/ivy-0.4.xml");
String ivyPattern = "build/test/lib/[conf]/[organisation]/[module]/ivy-[revision].xml";
retrieve.setIvypattern(ivyPattern);
retrieve.execute();
assertTrue(new File(IvyPatternHelper.substitute(ivyPattern, "org6", "mod6.1", "0.4", "ivy",
"ivy", "xml", "default")).exists());
assertTrue(new File(IvyPatternHelper.substitute(ivyPattern, "org6", "mod6.1", "0.4", "ivy",
"ivy", "xml", "extension")).exists());
assertFalse(new File(IvyPatternHelper.substitute(ivyPattern, "org1", "mod1.2", "2.1",
"ivy", "ivy", "xml", "extension")).exists());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:17,代码来源:IvyRetrieveTest.java
示例19: testRetrieveSimple
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
@Test
public void testRetrieveSimple() throws Exception {
// mod1.1 depends on mod1.2
ResolveReport report = ivy.resolve(new File(
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURI().toURL(),
getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
String pattern = "build/test/retrieve/[module]/[conf]/[artifact]-[revision].[ext]";
ivy.retrieve(md.getModuleRevisionId(),
getRetrieveOptions().setDestArtifactPattern(pattern));
assertTrue(new File(IvyPatternHelper.substitute(pattern, "org1", "mod1.2", "2.0", "mod1.2",
"jar", "jar", "default")).exists());
pattern = "build/test/retrieve/[module]/[conf]/[type]s/[artifact]-[revision].[ext]";
ivy.retrieve(md.getModuleRevisionId(),
getRetrieveOptions().setDestArtifactPattern(pattern));
assertTrue(new File(IvyPatternHelper.substitute(pattern, "org1", "mod1.2", "2.0", "mod1.2",
"jar", "jar", "default")).exists());
}
开发者ID:apache,项目名称:ant-ivy,代码行数:23,代码来源:RetrieveTest.java
示例20: testRetrieveSameFileConflict
import org.apache.ivy.core.IvyPatternHelper; //导入依赖的package包/类
@Test
public void testRetrieveSameFileConflict() throws Exception {
// mod1.1 depends on mod1.2
ResolveReport report = ivy.resolve(new File(
"test/repositories/1/org1/mod1.4/ivys/ivy-1.0.1.xml").toURI().toURL(),
getResolveOptions(new String[] {"*"}));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
String pattern = "build/test/retrieve/[module]/[artifact]-[revision].[ext]";
MockMessageLogger mockLogger = new MockMessageLogger();
Message.setDefaultLogger(mockLogger);
ivy.retrieve(md.getModuleRevisionId(),
getRetrieveOptions().setDestArtifactPattern(pattern));
assertTrue(new File(IvyPatternHelper.substitute(pattern, "org1", "mod1.2", "2.2", "mod1.2",
"jar", "jar", "default")).exists());
mockLogger.assertLogDoesntContain("conflict on");
}
开发者ID:apache,项目名称:ant-ivy,代码行数:20,代码来源:RetrieveTest.java
注:本文中的org.apache.ivy.core.IvyPatternHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论