|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.mojo.versions.api.PomHelper
public class PomHelper
Helper class for modifying pom files.
Field Summary | |
---|---|
static String |
APACHE_MAVEN_PLUGINS_GROUPID
|
Constructor Summary | |
---|---|
PomHelper()
|
Method Summary | |
---|---|
static void |
debugModules(org.apache.maven.plugin.logging.Log logger,
String message,
Collection modules)
Outputs a debug message with a list of modules. |
static Set |
getAllChildModules(org.apache.maven.project.MavenProject project,
org.apache.maven.plugin.logging.Log logger)
Returns a set of all child modules for a project, including any defined in profiles (ignoring profile activation). |
static Set |
getAllChildModules(org.apache.maven.model.Model model,
org.apache.maven.plugin.logging.Log logger)
Returns a set of all child modules for a project, including any defined in profiles (ignoring profile activation). |
static String |
getArtifactId(org.apache.maven.model.Model model)
Extracts the artifactId from a raw model, interpolating from the parent if necessary. |
static Map |
getChildModels(Map reactor,
String groupId,
String artifactId)
Returns all the models that have a specified groupId and artifactId as parent. |
static String |
getGroupId(org.apache.maven.model.Model model)
Extracts the groupId from a raw model, interpolating from the parent if necessary. |
static org.apache.maven.project.MavenProject |
getLocalRoot(org.apache.maven.project.MavenProjectBuilder builder,
org.apache.maven.project.MavenProject project,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
org.apache.maven.profiles.ProfileManager globalProfileManager,
org.apache.maven.plugin.logging.Log logger)
Finds the local root of the specified project. |
static org.apache.maven.model.Model |
getModel(Map reactor,
String groupId,
String artifactId)
Returns the model that has the specified groupId and artifactId or null if no such model exists. |
static org.apache.maven.artifact.Artifact |
getProjectParent(ModifiedPomXMLEventReader pom,
VersionsHelper helper)
Gets the parent artifact from the pom. |
static String |
getProjectVersion(ModifiedPomXMLEventReader pom)
Retrieves the project version from the pom. |
static org.codehaus.mojo.versions.api.PropertyVersionsBuilder[] |
getPropertyVersionsBuilders(VersionsHelper helper,
org.apache.maven.project.MavenProject project)
Examines the project to find any properties which are associated with versions of artifacts in the project. |
static org.apache.maven.model.Model |
getRawModel(File moduleProjectFile)
Gets the raw model before any interpolation what-so-ever. |
static org.apache.maven.model.Model |
getRawModel(org.apache.maven.project.MavenProject project)
Gets the raw model before any interpolation what-so-ever. |
static org.apache.maven.model.Model |
getRawModel(ModifiedPomXMLEventReader modifiedPomXMLEventReader)
Gets the current raw model before any interpolation what-so-ever. |
static Map |
getReactorModels(org.apache.maven.project.MavenProject project,
org.apache.maven.plugin.logging.Log logger)
Builds a map of raw models keyed by module path. |
static int |
getReactorParentCount(Map reactor,
org.apache.maven.model.Model model)
Returns a count of how many parents a model has in the reactor. |
static String |
getVersion(org.apache.maven.model.Model model)
Extracts the version from a raw model, interpolating from the parent if necessary. |
static StringBuffer |
readXmlFile(File outFile)
Reads a file into a String. |
static void |
removeMissingChildModules(org.apache.maven.plugin.logging.Log logger,
File basedir,
Collection childModules)
Modifies the collection of child modules removing those which cannot be found relative to the parent. |
static void |
removeMissingChildModules(org.apache.maven.plugin.logging.Log logger,
org.apache.maven.project.MavenProject project,
Collection childModules)
Modifies the collection of child modules removing those which cannot be found relative to the parent. |
static boolean |
setDependencyVersion(ModifiedPomXMLEventReader pom,
String groupId,
String artifactId,
String oldVersion,
String newVersion)
Searches the pom re-defining the specified dependency to the specified version. |
static boolean |
setPluginVersion(ModifiedPomXMLEventReader pom,
String groupId,
String artifactId,
String oldVersion,
String newVersion)
Searches the pom re-defining the specified plugin to the specified version. |
static boolean |
setProjectParentVersion(ModifiedPomXMLEventReader pom,
String value)
Searches the pom re-defining the project version to the specified version. |
static boolean |
setProjectVersion(ModifiedPomXMLEventReader pom,
String value)
Searches the pom re-defining the project version to the specified version. |
static boolean |
setPropertyVersion(ModifiedPomXMLEventReader pom,
String profileId,
String property,
String value)
Searches the pom re-defining the specified property to the specified version. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String APACHE_MAVEN_PLUGINS_GROUPID
Constructor Detail |
---|
public PomHelper()
Method Detail |
---|
public static org.apache.maven.model.Model getRawModel(org.apache.maven.project.MavenProject project) throws IOException
project
- The project to get the raw model for.
IOException
- if the file is not found or if the file does not parse.public static org.apache.maven.model.Model getRawModel(File moduleProjectFile) throws IOException
moduleProjectFile
- The project file to get the raw model for.
IOException
- if the file is not found or if the file does not parse.public static org.apache.maven.model.Model getRawModel(ModifiedPomXMLEventReader modifiedPomXMLEventReader) throws IOException
modifiedPomXMLEventReader
- The ModifiedPomXMLEventReader
to get the raw model for.
IOException
- if the file is not found or if the file does not parse.public static boolean setPropertyVersion(ModifiedPomXMLEventReader pom, String profileId, String property, String value) throws javax.xml.stream.XMLStreamException
pom
- The pom to modify.profileId
- The profile in which to modify the property.property
- The property to modify.value
- The new value of the property.
true
if a replacement was made.
javax.xml.stream.XMLStreamException
- if somethinh went wrong.public static boolean setProjectVersion(ModifiedPomXMLEventReader pom, String value) throws javax.xml.stream.XMLStreamException
pom
- The pom to modify.value
- The new value of the property.
true
if a replacement was made.
javax.xml.stream.XMLStreamException
- if somethinh went wrong.public static String getProjectVersion(ModifiedPomXMLEventReader pom) throws javax.xml.stream.XMLStreamException
pom
- The pom.
null
if the project version is not defined (i.e. inherited from parent version).
javax.xml.stream.XMLStreamException
- if something went wrong.public static boolean setProjectParentVersion(ModifiedPomXMLEventReader pom, String value) throws javax.xml.stream.XMLStreamException
pom
- The pom to modify.value
- The new value of the property.
true
if a replacement was made.
javax.xml.stream.XMLStreamException
- if somethinh went wrong.public static org.apache.maven.artifact.Artifact getProjectParent(ModifiedPomXMLEventReader pom, VersionsHelper helper) throws javax.xml.stream.XMLStreamException
pom
- The pom.helper
- The helper (used to create the artifact).
null
if no parent is specified.
javax.xml.stream.XMLStreamException
- if something went wrong.public static boolean setDependencyVersion(ModifiedPomXMLEventReader pom, String groupId, String artifactId, String oldVersion, String newVersion) throws javax.xml.stream.XMLStreamException
pom
- The pom to modify.groupId
- The groupId of the dependency.artifactId
- The artifactId of the dependency.oldVersion
- The old version of the dependency.newVersion
- The new version of the dependency.
true
if a replacement was made.
javax.xml.stream.XMLStreamException
- if somethinh went wrong.public static boolean setPluginVersion(ModifiedPomXMLEventReader pom, String groupId, String artifactId, String oldVersion, String newVersion) throws javax.xml.stream.XMLStreamException
pom
- The pom to modify.groupId
- The groupId of the dependency.artifactId
- The artifactId of the dependency.oldVersion
- The old version of the dependency.newVersion
- The new version of the dependency.
true
if a replacement was made.
javax.xml.stream.XMLStreamException
- if somethinh went wrong.public static org.codehaus.mojo.versions.api.PropertyVersionsBuilder[] getPropertyVersionsBuilders(VersionsHelper helper, org.apache.maven.project.MavenProject project) throws org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException, IOException
helper
- Our versions helper.project
- The project to examine.
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException
- if an expression cannot be evaluated.
IOException
- if the project's pom file cannot be parsed.public static Set getAllChildModules(org.apache.maven.project.MavenProject project, org.apache.maven.plugin.logging.Log logger)
project
- The project.logger
- The logger to use.
public static Set getAllChildModules(org.apache.maven.model.Model model, org.apache.maven.plugin.logging.Log logger)
model
- The project model.logger
- The logger to use.
public static void debugModules(org.apache.maven.plugin.logging.Log logger, String message, Collection modules)
logger
- The logger to log to.message
- The message to display.modules
- The modules to append to the message.public static void removeMissingChildModules(org.apache.maven.plugin.logging.Log logger, org.apache.maven.project.MavenProject project, Collection childModules)
logger
- The logger to log to.project
- the project.childModules
- the child modules.public static void removeMissingChildModules(org.apache.maven.plugin.logging.Log logger, File basedir, Collection childModules)
logger
- The logger to log to.basedir
- the project basedir.childModules
- the child modules.public static String getVersion(org.apache.maven.model.Model model)
model
- The model.
public static String getArtifactId(org.apache.maven.model.Model model)
model
- The model.
public static String getGroupId(org.apache.maven.model.Model model)
model
- The model.
public static org.apache.maven.project.MavenProject getLocalRoot(org.apache.maven.project.MavenProjectBuilder builder, org.apache.maven.project.MavenProject project, org.apache.maven.artifact.repository.ArtifactRepository localRepository, org.apache.maven.profiles.ProfileManager globalProfileManager, org.apache.maven.plugin.logging.Log logger)
project
- The project to find the local root for.localRepository
- the local repo.globalProfileManager
- the global profile manager.logger
-
public static Map getReactorModels(org.apache.maven.project.MavenProject project, org.apache.maven.plugin.logging.Log logger) throws IOException
project
- The project to build from.logger
- The logger for logging.
IOException
- if things go wrong.public static Map getChildModels(Map reactor, String groupId, String artifactId)
reactor
- The map of models keyed by path.groupId
- The groupId of the parent.artifactId
- The artifactId of the parent.
public static org.apache.maven.model.Model getModel(Map reactor, String groupId, String artifactId)
null
if no such model exists.
reactor
- The map of models keyed by path.groupId
- The groupId to match.artifactId
- The artifactId to match.
null
if the model was not in the reactor.public static int getReactorParentCount(Map reactor, org.apache.maven.model.Model model)
reactor
- The map of models keyed by path.model
- The model.
public static StringBuffer readXmlFile(File outFile) throws IOException
outFile
- The file to read.
IOException
- when things go wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |