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.metadata.ArtifactMetadataSource |
artifactMetadataSource
The artifact metadata source to use.
|
protected org.apache.maven.artifact.resolver.ArtifactResolver |
artifactResolver |
protected Set<String> |
ignoredVersions
Allows specifying ignored versions directly as an alternative
to providing the ruleSet parameter; mainly created
for
-D property usage. |
protected org.apache.maven.artifact.repository.ArtifactRepository |
localRepository |
protected org.apache.maven.project.MavenProject |
project
The Maven Project.
|
protected org.apache.maven.project.MavenProjectBuilder |
projectBuilder |
protected List<org.apache.maven.project.MavenProject> |
reactorProjects |
protected List<org.apache.maven.artifact.repository.ArtifactRepository> |
remoteArtifactRepositories |
protected List<org.apache.maven.artifact.repository.ArtifactRepository> |
remotePluginRepositories |
protected org.apache.maven.repository.RepositorySystem |
repositorySystem |
protected org.codehaus.mojo.versions.model.RuleSet |
ruleSet
Allows specifying the RuleSet object describing rules
on artifact versions to ignore when considering updates.
|
protected org.apache.maven.execution.MavenSession |
session
The Maven Session.
|
protected org.apache.maven.settings.Settings |
settings |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractVersionsUpdaterMojo(org.apache.maven.repository.RepositorySystem repositorySystem,
org.apache.maven.project.MavenProjectBuilder projectBuilder,
org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource,
org.apache.maven.artifact.manager.WagonManager wagonManager,
org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected ChangeRecorder |
getChangeRecorder()
Configure and return the change recorder.
|
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.
|
String |
getVersion() |
protected ModifiedPomXMLEventReader |
newModifiedPomXER(StringBuilder input,
String path)
Creates a
ModifiedPomXMLEventReader from a StringBuilder. |
protected void |
process(File outFile)
Processes the specified file.
|
protected void |
saveChangeRecorderResults()
Save all of the changes recorded by the change recorder.
|
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)
Deprecated.
This method no longer supported.
use shouldApplyUpdate( Artifact artifact, String currentVersion, ArtifactVersion updateVersion, Boolean
forceUpdate )
Returns |
protected boolean |
shouldApplyUpdate(org.apache.maven.artifact.Artifact artifact,
String currentVersion,
org.apache.maven.artifact.versioning.ArtifactVersion updateVersion,
boolean forceUpdate)
Returns
true if the update should be applied. |
protected abstract void |
update(ModifiedPomXMLEventReader pom)
Updates the pom.
|
protected org.apache.maven.artifact.versioning.ArtifactVersion |
updatePropertyToNewestVersion(ModifiedPomXMLEventReader pom,
Property property,
PropertyVersions version,
String currentVersion,
boolean allowDowngrade,
Optional<Segment> unchangedSegment) |
protected void |
writeFile(File outFile,
StringBuilder input)
Writes a StringBuilder into a file.
|
@Parameter(defaultValue="${project}",
required=true,
readonly=true)
protected org.apache.maven.project.MavenProject project
protected org.apache.maven.repository.RepositorySystem repositorySystem
protected org.apache.maven.project.MavenProjectBuilder projectBuilder
@Parameter(defaultValue="${reactorProjects}",
required=true,
readonly=true)
protected List<org.apache.maven.project.MavenProject> reactorProjects
protected org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
@Parameter(defaultValue="${project.remoteArtifactRepositories}",
readonly=true)
protected List<org.apache.maven.artifact.repository.ArtifactRepository> remoteArtifactRepositories
@Parameter(defaultValue="${project.pluginArtifactRepositories}",
readonly=true)
protected List<org.apache.maven.artifact.repository.ArtifactRepository> remotePluginRepositories
@Parameter(defaultValue="${localRepository}",
readonly=true)
protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
@Parameter(defaultValue="${settings}",
readonly=true)
protected org.apache.maven.settings.Settings settings
@Parameter(property="allowSnapshots",
defaultValue="false")
protected boolean allowSnapshots
@Parameter(defaultValue="${session}",
required=true,
readonly=true)
protected org.apache.maven.execution.MavenSession session
protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
@Parameter protected org.codehaus.mojo.versions.model.RuleSet ruleSet
Allows specifying the RuleSet object describing rules on artifact versions to ignore when considering updates.
@Parameter(property="maven.version.ignore") protected Set<String> ignoredVersions
Allows specifying ignored versions directly as an alternative
to providing the ruleSet parameter; mainly created
for -D property usage.
Example: "1\.0\.1,.+-M.,.*-SNAPSHOT"
Currently, this parameter will override the defined ruleSet
@Inject
protected AbstractVersionsUpdaterMojo(org.apache.maven.repository.RepositorySystem repositorySystem,
org.apache.maven.project.MavenProjectBuilder projectBuilder,
org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource,
org.apache.maven.artifact.manager.WagonManager wagonManager,
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 String getVersion()
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 - Use plugin repositoriesnull 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.MojoExecutionException - if something goes wrong.protected 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, String path)
ModifiedPomXMLEventReader from a StringBuilder.input - The XML to read and modify.path - Path pointing to the source of the XMLModifiedPomXMLEventReader.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.ArtifactMetadataRetrievalException - if something goes wrong.@Deprecated 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.
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 boolean shouldApplyUpdate(org.apache.maven.artifact.Artifact artifact,
String currentVersion,
org.apache.maven.artifact.versioning.ArtifactVersion updateVersion,
boolean forceUpdate)
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.forceUpdate - if true, LATEST and RELEASE versions will be overwritten with the real versiontrue if the update should be applied to the pom.protected org.apache.maven.artifact.versioning.ArtifactVersion updatePropertyToNewestVersion(ModifiedPomXMLEventReader pom, Property property, PropertyVersions version, String currentVersion, boolean allowDowngrade, Optional<Segment> unchangedSegment) throws XMLStreamException, org.apache.maven.artifact.versioning.InvalidVersionSpecificationException, InvalidSegmentException, org.apache.maven.plugin.MojoExecutionException
XMLStreamExceptionorg.apache.maven.artifact.versioning.InvalidVersionSpecificationExceptionInvalidSegmentExceptionorg.apache.maven.plugin.MojoExecutionExceptionprotected ChangeRecorder getChangeRecorder() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException - If the provided change recorder format is not validprotected void saveChangeRecorderResults()
throws IOException
IOException - On I/O errorsCopyright © 2008–2022 MojoHaus. All rights reserved.