本文整理汇总了Java中org.apache.ivy.plugins.parser.ModuleDescriptorParser类的典型用法代码示例。如果您正苦于以下问题:Java ModuleDescriptorParser类的具体用法?Java ModuleDescriptorParser怎么用?Java ModuleDescriptorParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleDescriptorParser类属于org.apache.ivy.plugins.parser包,在下文中一共展示了ModuleDescriptorParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deployEffectivePom
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
private void deployEffectivePom( ModuleRevisionId moduleRevisionId, Path artifactPath )
throws IOException
{
try
{
File pomFile = artifactPath.resolveSibling( artifactPath.getName( artifactPath.getNameCount() - 1 )
+ "-xmvn.pom" ).toFile();
ModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
ModuleDescriptor module =
parser.parseDescriptor( getSettings(), artifactPath.toFile().toURI().toURL(), false );
PomModuleDescriptorWriter.write( module, pomFile, new PomWriterOptions() );
org.fedoraproject.xmvn.artifact.Artifact artifact = ivy2aether( moduleRevisionId, "pom" );
deploy( artifact, null, artifactPath );
}
catch ( ParseException e )
{
throw new IOException( e );
}
}
示例2: resolve
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
/**
* Resolve dependencies of a module described by an ivy file.
*
* @param ivySource URL
* @param options ResolveOptions
* @return ResolveReport
* @throws ParseException if something goes wrong
* @throws IOException if something goes wrong
*/
public ResolveReport resolve(URL ivySource, ResolveOptions options) throws ParseException,
IOException {
URLResource res = new URLResource(ivySource);
ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(res);
Message.verbose("using " + parser + " to parse " + ivySource);
ModuleDescriptor md = parser.parseDescriptor(settings, ivySource, options.isValidate());
String revision = options.getRevision();
if (revision == null && md.getResolvedModuleRevisionId().getRevision() == null) {
revision = Ivy.getWorkingRevision();
}
if (revision != null) {
md.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(md.getModuleRevisionId(),
revision));
}
return resolve(md, options);
}
示例3: parseParentModuleOnFilesystem
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
/**
* Returns the parent module using the location attribute (for dev purpose).
*
* @param location
* a given location
* @throws IOException
* @throws ParseException
*/
private ModuleDescriptor parseParentModuleOnFilesystem(String location) throws IOException, ParseException {
if (!"file".equals(getDescriptorURL().getProtocol())) {
return null;
}
File file = new File(location);
if (!file.isAbsolute()) {
URL url = getSettings().getRelativeUrlResolver().getURL(getDescriptorURL(), location);
try {
file = new File(new URI(url.toExternalForm()));
} catch (URISyntaxException e) {
file = new File(url.getPath());
}
}
file = FileUtil.normalize(file.getAbsolutePath());
if (!file.exists()) {
Message.verbose("Parent module doesn't exist on the filesystem: " + file.getAbsolutePath());
return null;
}
FileResource res = new FileResource(null, file);
ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(res);
return parser.parseDescriptor(getSettings(), file.toURI().toURL(), res, isValidate());
}
示例4: readIvyModuleDescriptorFromPom
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
private ModuleDescriptor readIvyModuleDescriptorFromPom( DependencyDescriptor depDescriptor )
throws IOException, ParseException
{
ModuleRevisionId depId = depDescriptor.getDependencyRevisionId();
ResolutionRequest request = new ResolutionRequest();
request.setArtifact( ivy2aether( depId, "pom" ) );
ResolutionResult result = getResolver().resolve( request );
Path pomPath = result.getArtifactPath();
String version;
ModuleDescriptor module;
if ( pomPath != null )
{
ModuleDescriptorParser parser = PomModuleDescriptorParser.getInstance();
module = parser.parseDescriptor( getSettings(), pomPath.toFile().toURI().toURL(), false );
version = resolvedVersion( result );
}
else
{
module = DefaultModuleDescriptor.newDefaultInstance( depId, depDescriptor.getAllDependencyArtifacts() );
version = resolveModuleVersion( module );
if ( version == null )
return null;
}
module.setResolvedModuleRevisionId( ModuleRevisionId.newInstance( depId, version ) );
return module;
}
示例5: parseModuleDescriptor
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
protected ModuleDescriptor parseModuleDescriptor(DependencyResolver resolver, Artifact moduleArtifact, CacheMetadataOptions options, File artifactFile, Resource resource) throws ParseException {
ModuleRevisionId moduleRevisionId = moduleArtifact.getId().getModuleRevisionId();
try {
IvySettings ivySettings = IvyContextualiser.getIvyContext().getSettings();
ParserSettings parserSettings = new LegacyResolverParserSettings(ivySettings, resolver, moduleRevisionId);
ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(resource);
return parser.parseDescriptor(parserSettings, new URL(artifactFile.toURI().toASCIIString()), resource, options.isValidate());
} catch (IOException e) {
throw UncheckedException.throwAsUncheckedException(e);
}
}
示例6: getStaledMd
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
private ModuleDescriptor getStaledMd(ModuleDescriptorParser mdParser,
CacheMetadataOptions options, File ivyFile, ParserSettings parserSettings)
throws ParseException, IOException {
ModuleDescriptorMemoryCache cache = getMemoryCache();
ModuleDescriptorProvider mdProvider = new MyModuleDescriptorProvider(mdParser,
parserSettings);
return cache.getStale(ivyFile, settings, options.isValidate(), mdProvider);
}
示例7: PomModuleDescriptorBuilder
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public PomModuleDescriptorBuilder(ModuleDescriptorParser parser, Resource res,
ParserSettings ivySettings) {
ivyModuleDescriptor = new PomModuleDescriptor(parser, res);
ivyModuleDescriptor.setResolvedPublicationDate(new Date(res.getLastModified()));
for (Configuration m2conf : MAVEN2_CONFIGURATIONS) {
ivyModuleDescriptor.addConfiguration(m2conf);
}
ivyModuleDescriptor.setMappingOverride(true);
ivyModuleDescriptor.addExtraAttributeNamespace("m", Ivy.getIvyHomeURL() + "maven");
parserSettings = ivySettings;
}
示例8: parseParentModuleOnFilesystem
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
/**
* Returns the parent module using the location attribute (for dev purpose).
*
* @param location
* a given location
* @throws IOException if something goes wrong
* @throws ParseException if something goes wrong
*/
private ModuleDescriptor parseParentModuleOnFilesystem(String location) throws IOException,
ParseException {
if (!"file".equals(descriptorURL.getProtocol())) {
return null;
}
File file = new File(location);
if (!file.isAbsolute()) {
URL url = settings.getRelativeUrlResolver().getURL(descriptorURL, location);
try {
file = new File(new URI(url.toExternalForm()));
} catch (URISyntaxException e) {
file = new File(url.getPath());
}
}
file = FileUtil.normalize(file.getAbsolutePath());
if (!file.exists()) {
Message.verbose("Parent module doesn't exist on the filesystem: "
+ file.getAbsolutePath());
return null;
}
FileResource res = new FileResource(null, file);
ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(
res);
return parser.parseDescriptor(getSettings(), file.toURI().toURL(), res, isValidate());
}
示例9: cacheModuleDescriptor
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
private void cacheModuleDescriptor(ModuleDescriptor systemMd, ModuleRevisionId systemMrid,
ResolvedResource ivyRef, ResolvedModuleRevision rmr) {
RepositoryCacheManager cacheManager = getRepositoryCacheManager();
final ModuleDescriptorParser parser = systemMd.getParser();
// the metadata artifact which was used to cache the original metadata file
Artifact requestedMetadataArtifact = (ivyRef == null) ? systemMd.getMetadataArtifact()
: parser.getMetadataArtifact(
ModuleRevisionId.newInstance(systemMrid, systemMd.getRevision()),
ivyRef.getResource());
cacheManager.originalToCachedModuleDescriptor(this, ivyRef, requestedMetadataArtifact, rmr,
new ModuleDescriptorWriter() {
public void write(ResolvedResource originalMdResource, ModuleDescriptor md,
File src, File dest) throws IOException, ParseException {
if (originalMdResource == null) {
// a basic ivy file is written containing default data
XmlModuleDescriptorWriter.write(md, dest);
} else {
// copy and update ivy file from source to cache
parser.toIvyFile(new FileInputStream(src),
originalMdResource.getResource(), dest, md);
long repLastModified = originalMdResource.getLastModified();
if (repLastModified > 0) {
dest.setLastModified(repLastModified);
}
}
}
});
}
示例10: getModuleDescriptorParser
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
@Override
protected ModuleDescriptorParser getModuleDescriptorParser(File moduleDescriptorFile) {
try {
return ModuleDescriptorParserRegistry.getInstance().getParser(
new URLResource(moduleDescriptorFile.toURI().toURL()));
} catch (MalformedURLException e) {
throw new RuntimeException("Can't access to " + moduleDescriptorFile.getAbsolutePath(), e);
}
}
示例11: toModuleDescriptor
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public static DefaultModuleDescriptor toModuleDescriptor(ModuleDescriptorParser parser,
URI baseUri, BundleInfo bundle, ExecutionEnvironmentProfileProvider profileProvider) {
return toModuleDescriptor(parser, baseUri, bundle, null, profileProvider);
}
示例12: getParser
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public ModuleDescriptorParser getParser() {
return parser;
}
示例13: DefaultWorkspaceModuleDescriptor
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public DefaultWorkspaceModuleDescriptor(ModuleDescriptorParser parser, Resource res) {
super(parser, res);
}
示例14: MyModuleDescriptorProvider
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public MyModuleDescriptorProvider(ModuleDescriptorParser mdParser, ParserSettings settings) {
this.mdParser = mdParser;
this.settings = settings;
}
示例15: getMdFromCache
import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
private ModuleDescriptor getMdFromCache(ModuleDescriptorParser mdParser,
CacheMetadataOptions options, File ivyFile) throws ParseException, IOException {
ModuleDescriptorMemoryCache cache = getMemoryCache();
ModuleDescriptorProvider mdProvider = new MyModuleDescriptorProvider(mdParser, settings);
return cache.get(ivyFile, settings, options.isValidate(), mdProvider);
}