本文整理汇总了Java中org.apache.ivy.core.IvyPatternHelper类的典型用法代码示例。如果您正苦于以下问题:Java IvyPatternHelper类的具体用法?Java IvyPatternHelper怎么用?Java IvyPatternHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IvyPatternHelper类属于org.apache.ivy.core包,在下文中一共展示了IvyPatternHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
}
示例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);
}
}
}
示例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()]);
}
示例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);
}
示例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()]);
}
示例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()]);
}
示例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()]);
}
示例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()]);
}
示例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);
}
示例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;
}
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}