|
||||||||||
| 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
|
static String |
POM_ENCODING
The encoding used for the pom file. |
| Constructor Summary | |
|---|---|
PomHelper()
|
|
| Method Summary | |
|---|---|
static void |
debugModules(Log logger,
String message,
Collection modules)
Outputs a debug message with a list of modules. |
static Set |
getAllChildModules(MavenProject project,
Log logger)
Returns a set of all child modules for a project, including any defined in profiles (ignoring profile activation). |
static 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 PropertyVersions[] |
getPropertyVersions(VersionsHelper helper,
MavenProject project,
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator expressionEvaluator)
Examines the project to find any properties which are associated with versions of artifacts in the project. |
static Model |
getRawModel(MavenProject project)
Gets the raw model before any interpolation what-so-ever. |
static void |
removeMissingChildModules(Log logger,
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 POM_ENCODING
public static final String APACHE_MAVEN_PLUGINS_GROUPID
| Constructor Detail |
|---|
public PomHelper()
| Method Detail |
|---|
public static Model getRawModel(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 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 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 PropertyVersions[] getPropertyVersions(VersionsHelper helper,
MavenProject project,
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator expressionEvaluator)
throws org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException,
IOException
helper - Our versions helper.project - The project to examine.expressionEvaluator - The expression evaluator to use when examining properties.
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(MavenProject project,
Log logger)
project - The project.logger -
public static void debugModules(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(Log logger,
MavenProject project,
Collection childModules)
logger - The logger to log to.project - the project.childModules - the child modules.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||