public abstract class AbstractVersionsUpdaterMojo
extends org.apache.maven.plugin.AbstractMojo
| Modifier and Type | Field and Description |
|---|---|
protected Boolean |
allowSnapshots
Whether to allow snapshots when searching for the latest version of an artifact.
|
protected org.apache.maven.artifact.factory.ArtifactFactory |
artifactFactory |
protected org.apache.maven.artifact.metadata.ArtifactMetadataSource |
artifactMetadataSource
The artifact metadata source to use.
|
protected org.apache.maven.artifact.resolver.ArtifactResolver |
artifactResolver |
protected org.apache.maven.artifact.repository.ArtifactRepository |
localRepository |
protected org.apache.maven.project.path.PathTranslator |
pathTranslator |
protected org.apache.maven.project.MavenProjectBuilder |
projectBuilder |
protected List |
reactorProjects |
protected List |
remoteArtifactRepositories |
protected List |
remotePluginRepositories |
protected org.apache.maven.artifact.resolver.ArtifactResolver |
resolver |
protected org.apache.maven.execution.MavenSession |
session
The Maven Session.
|
protected org.apache.maven.settings.Settings |
settings |
| Constructor and Description |
|---|
AbstractVersionsUpdaterMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
determineUnchangedSegment(Boolean allowMajorUpdates,
Boolean allowMinorUpdates,
Boolean allowIncrementalUpdates)
Based on the passed flags, determines which segment is unchangable.
|
void |
execute() |
protected org.apache.maven.artifact.versioning.ArtifactVersion |
findLatestVersion(org.apache.maven.artifact.Artifact artifact,
org.apache.maven.artifact.versioning.VersionRange versionRange,
Boolean allowingSnapshots,
boolean usePluginRepositories)
Finds the latest version of the specified artifact that matches the version range.
|
VersionsHelper |
getHelper() |
org.apache.maven.project.MavenProject |
getProject()
Getter for property 'project'.
|
protected String |
getPropertyValue(StringBuilder pom,
String property)
Gets the property value that is defined in the pom.
|
protected ModifiedPomXMLEventReader |
newModifiedPomXER(StringBuilder input)
Creates a
ModifiedPomXMLEventReader from a StringBuilder. |
protected void |
process(File outFile)
Processes the specified file.
|
void |
setProject(org.apache.maven.project.MavenProject project)
Setter for property 'project'.
|
protected boolean |
shouldApplyUpdate(org.apache.maven.artifact.Artifact artifact,
String currentVersion,
org.apache.maven.artifact.versioning.ArtifactVersion updateVersion)
Returns
true if the update should be applied. |
protected abstract void |
update(ModifiedPomXMLEventReader pom)
Updates the pom.
|
protected void |
updatePropertyToNewestVersion(ModifiedPomXMLEventReader pom,
Property property,
PropertyVersions version,
String currentVersion) |
protected void |
writeFile(File outFile,
StringBuilder input)
Writes a StringBuilder into a file.
|
protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
protected org.apache.maven.artifact.resolver.ArtifactResolver resolver
protected org.apache.maven.project.MavenProjectBuilder projectBuilder
protected List reactorProjects
protected org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
protected List remoteArtifactRepositories
protected List remotePluginRepositories
protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
protected org.apache.maven.settings.Settings settings
protected Boolean allowSnapshots
protected org.apache.maven.execution.MavenSession session
protected org.apache.maven.project.path.PathTranslator pathTranslator
protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
public VersionsHelper getHelper() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionpublic org.apache.maven.project.MavenProject getProject()
public void setProject(org.apache.maven.project.MavenProject project)
project - Value to set for property 'project'.public void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionprotected org.apache.maven.artifact.versioning.ArtifactVersion findLatestVersion(org.apache.maven.artifact.Artifact artifact,
org.apache.maven.artifact.versioning.VersionRange versionRange,
Boolean allowingSnapshots,
boolean usePluginRepositories)
throws org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException,
org.apache.maven.plugin.MojoExecutionException
artifact - The artifact.versionRange - The version range.allowingSnapshots - null for no override, otherwise the local override to apply.usePluginRepositories - null if no matching version could be found.org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException - If the artifact metadata could not be found.org.apache.maven.plugin.MojoExecutionExceptionprotected String getPropertyValue(StringBuilder pom, String property)
pom - The pom.property - The property.null if not defined.protected void process(File outFile) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
outFile - The file to process.org.apache.maven.plugin.MojoExecutionException - If things go wrong.org.apache.maven.plugin.MojoFailureException - If things go wrong.protected final ModifiedPomXMLEventReader newModifiedPomXER(StringBuilder input)
ModifiedPomXMLEventReader from a StringBuilder.input - The XML to read and modify.ModifiedPomXMLEventReader.protected final void writeFile(File outFile, StringBuilder input) throws IOException
outFile - The file to read.input - The contents of the file.IOException - when things go wrong.protected abstract void update(ModifiedPomXMLEventReader pom) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException, XMLStreamException, org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException
pom - The pom to update.org.apache.maven.plugin.MojoExecutionException - If things go wrong.org.apache.maven.plugin.MojoFailureException - If things go wrong.XMLStreamException - If things go wrong.org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalExceptionprotected boolean shouldApplyUpdate(org.apache.maven.artifact.Artifact artifact,
String currentVersion,
org.apache.maven.artifact.versioning.ArtifactVersion updateVersion)
true if the update should be applied.artifact - The artifact.currentVersion - The current version of the artifact.updateVersion - The proposed new version of the artifact.true if the update should be applied.protected int determineUnchangedSegment(Boolean allowMajorUpdates, Boolean allowMinorUpdates, Boolean allowIncrementalUpdates)
allowMajorUpdates - allowMinorUpdates - allowIncrementalUpdates - protected void updatePropertyToNewestVersion(ModifiedPomXMLEventReader pom, Property property, PropertyVersions version, String currentVersion) throws org.apache.maven.plugin.MojoExecutionException, XMLStreamException
org.apache.maven.plugin.MojoExecutionExceptionXMLStreamExceptionCopyright © 2008-2014. All Rights Reserved.