Package org.apache.ivy.plugins.parser.m2
Class PomModuleDescriptorParser
- java.lang.Object
-
- org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser
-
- All Implemented Interfaces:
ModuleDescriptorParser
public final class PomModuleDescriptorParser extends java.lang.Object implements ModuleDescriptorParser
A parser for Maven 2 POM.The configurations used in the generated module descriptor mimics the behavior defined by Maven 2 scopes, as documented here. The PomModuleDescriptorParser use a PomDomReader to read the pom, and the PomModuleDescriptorBuilder to write the ivy module descriptor using the info read by the PomDomReader.
-
-
Field Summary
Fields Modifier and Type Field Description private static PomModuleDescriptorParser
INSTANCE
private static java.lang.String
PARENT_MAP_KEY
-
Constructor Summary
Constructors Modifier Constructor Description private
PomModuleDescriptorParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(Resource res)
private void
addSourcesAndJavadocArtifactsIfPresent(PomModuleDescriptorBuilder mdBuilder, ParserSettings ivySettings)
private void
addTo(PomModuleDescriptorBuilder mdBuilder, PomDependencyMgt dep, ParserSettings ivySettings)
static PomModuleDescriptorParser
getInstance()
Artifact
getMetadataArtifact(ModuleRevisionId mrid, Resource res)
Returns the module metadata artifact corresponding to the given module revision id that this parser parsesjava.lang.String
getType()
Return the 'type' of module artifacts this parser is parsingprivate java.text.ParseException
newParserException(java.lang.Exception e)
ModuleDescriptor
parseDescriptor(ParserSettings ivySettings, java.net.URL descriptorURL, boolean validate)
ModuleDescriptor
parseDescriptor(ParserSettings ivySettings, java.net.URL descriptorURL, Resource res, boolean validate)
private ResolvedModuleRevision
parseOtherPom(ParserSettings ivySettings, ModuleRevisionId parentModRevID, boolean isParentPom)
void
toIvyFile(java.io.InputStream is, Resource res, java.io.File destFile, ModuleDescriptor md)
Convert a module descriptor to an ivy file.java.lang.String
toString()
-
-
-
Field Detail
-
INSTANCE
private static final PomModuleDescriptorParser INSTANCE
-
PARENT_MAP_KEY
private static final java.lang.String PARENT_MAP_KEY
-
-
Method Detail
-
getInstance
public static PomModuleDescriptorParser getInstance()
-
toIvyFile
public void toIvyFile(java.io.InputStream is, Resource res, java.io.File destFile, ModuleDescriptor md) throws java.text.ParseException, java.io.IOException
Description copied from interface:ModuleDescriptorParser
Convert a module descriptor to an ivy file. This method MUST close the given input stream when job is finished- Specified by:
toIvyFile
in interfaceModuleDescriptorParser
- Parameters:
is
- input stream with opened on original module descriptor resourceres
- ResourcedestFile
- Filemd
- ModuleDescriptor- Throws:
java.text.ParseException
- if something goes wrongjava.io.IOException
- if something goes wrong
-
accept
public boolean accept(Resource res)
- Specified by:
accept
in interfaceModuleDescriptorParser
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getMetadataArtifact
public Artifact getMetadataArtifact(ModuleRevisionId mrid, Resource res)
Description copied from interface:ModuleDescriptorParser
Returns the module metadata artifact corresponding to the given module revision id that this parser parses- Specified by:
getMetadataArtifact
in interfaceModuleDescriptorParser
- Parameters:
mrid
- the module revision id for which the module artifact should be returnedres
- the resource for which the module artifact should be returned- Returns:
- the module artifact corresponding to the given mrid and resource
-
getType
public java.lang.String getType()
Description copied from interface:ModuleDescriptorParser
Return the 'type' of module artifacts this parser is parsing- Specified by:
getType
in interfaceModuleDescriptorParser
- Returns:
- the 'type' of module artifacts this parser is parsing
-
parseDescriptor
public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, java.net.URL descriptorURL, boolean validate) throws java.text.ParseException, java.io.IOException
- Specified by:
parseDescriptor
in interfaceModuleDescriptorParser
- Throws:
java.text.ParseException
java.io.IOException
-
parseDescriptor
public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, java.net.URL descriptorURL, Resource res, boolean validate) throws java.text.ParseException, java.io.IOException
- Specified by:
parseDescriptor
in interfaceModuleDescriptorParser
- Throws:
java.text.ParseException
java.io.IOException
-
addTo
private void addTo(PomModuleDescriptorBuilder mdBuilder, PomDependencyMgt dep, ParserSettings ivySettings) throws java.text.ParseException, java.io.IOException
- Throws:
java.text.ParseException
java.io.IOException
-
addSourcesAndJavadocArtifactsIfPresent
private void addSourcesAndJavadocArtifactsIfPresent(PomModuleDescriptorBuilder mdBuilder, ParserSettings ivySettings)
-
parseOtherPom
private ResolvedModuleRevision parseOtherPom(ParserSettings ivySettings, ModuleRevisionId parentModRevID, boolean isParentPom) throws java.text.ParseException
- Throws:
java.text.ParseException
-
newParserException
private java.text.ParseException newParserException(java.lang.Exception e)
-
-