@Mojo(name="set-version",
aggregator=true,
requiresDirectInvocation=true)
public class SetMojo
extends org.apache.maven.plugin.AbstractMojo
Sets the version of the current project and child projects with the same version, and updates references as necessary.
The set-version goal implements a version refactoring for a Tycho reactor: When updating the version of a project, it consistently updates the version strings in the project's configuration files (e.g. pom.xml and META-INF/MANIFEST.MF) and all references to that project (e.g. in a feature.xml).
In many cases, the set-version goal changes the version of multiple projects or entities at once. In addition to the current project, child projects with the same version are also changed. The set of version changes is determined according to the following rules:
updateVersionRangeMatchingBounds
is true and one of the bounds is matching the
original version
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
artifacts
Initial list of of projects to be changed.
|
private VersionsEngine |
engine |
private ProjectMetadataReader |
metadataReader |
private java.lang.String |
newVersion
The new version to set to the current project and other entities which have the same version
as the current project.
|
private java.lang.String |
properties
Comma separated list of names of POM properties to set the new version to.
|
private org.apache.maven.execution.MavenSession |
session |
private boolean |
updateVersionRangeMatchingBounds
When true bounds of OSGI version ranges referencing the version of an element that changed
version will be updated to match the newVersion.
|
Constructor and Description |
---|
SetMojo() |
Modifier and Type | Method and Description |
---|---|
void |
execute() |
private static java.util.List<java.lang.String> |
split(java.lang.String str) |
@Parameter(property="newVersion", required=true, alias="developmentVersion") private java.lang.String newVersion
The new version to set to the current project and other entities which have the same version as the current project.
@Parameter(property="artifacts", defaultValue="${project.artifactId}") private java.lang.String artifacts
Initial list of of projects to be changed. From these projects, the full list of projects to be changed is derived according to the rules described above. If set, this parameter needs to be specified as a comma separated list of artifactIds.
@Parameter(property="updateVersionRangeMatchingBounds", defaultValue="false") private boolean updateVersionRangeMatchingBounds
When true bounds of OSGI version ranges referencing the version of an element that changed version will be updated to match the newVersion.
@Parameter(property="properties") private java.lang.String properties
Comma separated list of names of POM properties to set the new version to. Note that
properties are only changed in the projects explicitly listed by the artifacts
parameter.
@Component private VersionsEngine engine
@Parameter(property="session", readonly=true) private org.apache.maven.execution.MavenSession session
@Component private ProjectMetadataReader metadataReader
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
private static java.util.List<java.lang.String> split(java.lang.String str)