public class PomFinder
extends java.lang.Object
This utility class helps with finding a maven pom file which got parsed previously. It uses the fact that the combination of any parent ids plus the ids of the current pom itself is unique.
This is e.g. needed for SCM systems which do not support sparse checkout but only can checkout the repository as whole like e.g. GIT. If the module which we are going to release is not in the parent directory, we first need to search for the 'right' sub directory in this case. subdirectory
PomFinder is a statefull class. One instance of this class intended for a singular use! You need to create a new instance if you like to search for another pom.
parsePom(java.io.File)
This will act as the information about what to search for.
findMatchingPom(java.io.File)
Modifier and Type | Class and Description |
---|---|
private static class |
PomFinder.PomInfo
Data container which helds information about a pom.
|
Modifier and Type | Field and Description |
---|---|
private PomFinder.PomInfo |
foundPomInfo |
private org.codehaus.plexus.logging.Logger |
log |
Constructor and Description |
---|
PomFinder(org.codehaus.plexus.logging.Logger log) |
Modifier and Type | Method and Description |
---|---|
java.io.File |
findMatchingPom(java.io.File startDirectory)
Search for the previously with
parsePom(java.io.File)
parsed pom in the given directory. |
boolean |
parsePom(java.io.File originPom) |
private PomFinder.PomInfo |
readPomInfo(java.io.File pomFile)
Read the
PomFinder.PomInfo from the given pom file |
private org.codehaus.plexus.logging.Logger log
private PomFinder.PomInfo foundPomInfo
public boolean parsePom(java.io.File originPom)
originPom
- the pom File which should be used as blueprint for the searchtrue
if a pom got parsed successfully, false
otherwisepublic java.io.File findMatchingPom(java.io.File startDirectory)
parsePom(java.io.File)
parsed pom in the given directory.startDirectory
- null
if no matching pom file could have been found.private PomFinder.PomInfo readPomInfo(java.io.File pomFile) throws java.io.IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException
PomFinder.PomInfo
from the given pom filepomFile
- pom.xml filenull
java.io.IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException