@Mojo(name="update-release-properties",
requiresDirectInvocation=true)
@Execute(phase=PACKAGE)
public class UpdateReleasePropertiesMojo
extends org.apache.maven.plugin.AbstractMojo
Modifier and Type | Field and Description |
---|---|
protected boolean |
alwaysCheckForReleaseVersion
If true (the default) revapi will always download the information about the latest version from the remote
repositories (instead of using locally cached info).
|
protected org.codehaus.plexus.configuration.PlexusConfiguration |
analysisConfiguration
The JSON or XML configuration of various analysis options.
|
protected Object[] |
analysisConfigurationFiles
The list of files containing the configuration of various analysis options.
|
protected boolean |
checkDependencies
Whether to include the dependencies in the API checks.
|
protected String |
disallowedExtensions
A comma-separated list of extensions (fully-qualified class names thereof) that are not taken into account during
API analysis for versioning purposes.
|
protected boolean |
expandProperties
If set to true, the Maven properties will be expanded in the configuration before it is supplied to Revapi.
|
protected boolean |
failBuildOnProblemsFound
If true (the default), the maven plugin will fail the build when it finds API problems (e.g.
|
protected String |
failCriticality
The minimum criticality of the found differences at which to fail the build.
|
protected boolean |
failOnMissingConfigurationFiles
Set to false if you want to tolerate files referenced in the
analysisConfigurationFiles missing on the
filesystem and therefore not contributing to the analysis configuration. |
protected boolean |
failOnUnresolvedArtifacts
If true, the build will fail if one of the old or new artifacts fails to be resolved.
|
protected boolean |
failOnUnresolvedDependencies
If true, the build will fail if some of the dependencies of the old or new artifacts fail to be resolved.
|
protected FailSeverity |
failSeverity
Deprecated.
use the new
failCriticality |
protected org.apache.maven.execution.MavenSession |
mavenSession |
protected String[] |
newArtifacts
The coordinates of the new artifacts.
|
protected String |
newVersion
The new version of the artifact.
|
protected String[] |
oldArtifacts
The coordinates of the old artifacts.
|
protected String |
oldVersion
If you don't want to compare a different artifact than the one being built, specifying the just the old version
is simpler way of specifying the old artifact.
|
protected org.codehaus.plexus.configuration.PlexusConfiguration |
pipelineConfiguration
The JSON or XML configuration of the extensions pipeline.
|
protected org.apache.maven.project.MavenProject |
project |
protected org.eclipse.aether.RepositorySystem |
repositorySystem |
protected org.eclipse.aether.RepositorySystemSession |
repositorySystemSession |
protected boolean |
resolveProvidedDependencies
When establishing the API classes, Revapi by default also looks through the
provided dependencies. |
protected boolean |
resolveTransitiveProvidedDependencies
In addition to
resolveProvidedDependencies this property further controls how provided dependencies
are resolved. |
protected boolean |
skip
Whether to skip the mojo execution.
|
protected String |
versionFormat
If set, this property demands a format of the version string when the
oldVersion or newVersion
parameters are set to RELEASE or LATEST special version strings. |
Constructor and Description |
---|
UpdateReleasePropertiesMojo() |
Modifier and Type | Method and Description |
---|---|
protected org.revapi.AnalysisResult |
analyze(Class<? extends org.revapi.Reporter> reporter,
org.revapi.PipelineConfiguration.Builder pipelineConfiguration,
Object... contextDataKeyValues) |
protected org.revapi.Criticality |
determineMaximumCriticality(org.revapi.PipelineConfiguration pipelineConfiguration) |
void |
execute() |
String |
getReplacementSuffix() |
protected boolean |
initializeComparisonArtifacts() |
boolean |
isPreserveSuffix() |
boolean |
isSingleVersionForAllModules() |
protected Analyzer |
prepareAnalyzer(org.apache.maven.project.MavenProject project,
org.revapi.PipelineConfiguration.Builder pipelineConfiguration,
Class<? extends org.revapi.Reporter> reporter,
Map<String,Object> contextData) |
protected Analyzer |
prepareAnalyzer(org.apache.maven.project.MavenProject project,
org.revapi.PipelineConfiguration.Builder pipelineConfiguration,
Class<? extends org.revapi.Reporter> reporter,
Map<String,Object> contextData,
Map<String,Object> propertyOverrides) |
@Component protected org.apache.maven.execution.MavenSession mavenSession
@Parameter(property="revapi.disallowedExtensions", defaultValue="org.revapi.basic.SemverIgnoreTransform") protected String disallowedExtensions
You can modify this set if you use another extensions that change the found differences in a way that the determined new version would not correspond to what it should be.
@Parameter(property="", defaultValue="") protected org.codehaus.plexus.configuration.PlexusConfiguration pipelineConfiguration
@Parameter(property="", defaultValue="") protected org.codehaus.plexus.configuration.PlexusConfiguration analysisConfiguration
<dependencies>
.
Consult configuration documentation for more details.
These settings take precedence over the configuration loaded from analysisConfigurationFiles
.
@Parameter(property="revapi.failOnMissingConfigurationFiles", defaultValue="true") protected boolean failOnMissingConfigurationFiles
analysisConfigurationFiles
missing on the
filesystem and therefore not contributing to the analysis configuration.
The default is true
, which means that a missing analysis configuration file will fail the build.
@Parameter(property="revapi.analysisConfigurationFiles", defaultValue="") protected Object[] analysisConfigurationFiles
<dependencies>
.
The analysisConfiguration
can override the settings present in the files.
The list is either a list of strings or has the following form:
<analysisConfigurationFiles>
<configurationFile>
<path>path/to/the/file/relative/to/project/base/dir</path>
<resource>path/to/the/file/in/one/of/the/dependencies</resource>
<roots>
<root>configuration/root1</root>
<root>configuration/root2</root>
...
</roots>
</configurationFile>
...
</analysisConfigurationFiles>
where
path
is the path on the filesystem,resource
is the path to the resource file in one of the artifacts the plugin depends onroots
is optional and specifies the subtrees of the JSON/XML config that should be used for
configuration. If not specified, the whole file is taken into account.path
or resource
has to be specified but not both. The configuration/root1
and
configuration/root2
are paths to the roots of the configuration inside that JSON/XML config file. This
might be used in cases where multiple configurations are stored within a single file and you want to use
a particular one.
An example of this might be a config file which contains API changes to be ignored in all past versions of a library. The classes to be ignored are specified in a configuration that is specific for each version:
{
"0.1.0" : [
{
"extension": "revapi.ignore",
"configuration": [
{
"code" : "java.method.addedToInterface",
"new" : "method void com.example.MyInterface::newMethod()",
"justification" : "This interface is not supposed to be implemented by clients."
},
...
]
}
],
"0.2.0" : [
...
]
}
@Parameter(property="revapi.oldArtifacts", defaultValue="") protected String[] oldArtifacts
oldVersion
property is checked for a value of the old version of the
artifact being built.oldVersion
@Parameter(property="revapi.oldVersion", defaultValue="RELEASE") protected String oldVersion
@Parameter(property="revapi.newArtifacts", defaultValue="") protected String[] newArtifacts
newVersion
property instead.@Parameter(property="revapi.newVersion", defaultValue="${project.version}") protected String newVersion
@Parameter(property="revapi.skip", defaultValue="false") protected boolean skip
@Parameter(property="revapi.failSeverity", defaultValue="potentiallyBreaking") @Deprecated protected FailSeverity failSeverity
failCriticality
@Parameter(property="revapi.maximumCriticality") protected String failCriticality
allowed
, documented
, highlight
, error
).
If not defined, the value is derived from failSeverity
using the severity-to-criticality mapping
(which is again configured in the pipeline configuration. If not defined in the pipeline configuration
explicitly, the default mapping is the following: EQUIVALENT
= allowed
, NON_BREAKING
=
documented
, POTENTIALLY_BREAKING
= error
, BREAKING
= error.@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project
@Component protected org.eclipse.aether.RepositorySystem repositorySystem
@Parameter(defaultValue="${repositorySystemSession}", readonly=true) protected org.eclipse.aether.RepositorySystemSession repositorySystemSession
@Parameter(property="revapi.alwaysCheckForReleaseVersion", defaultValue="true") protected boolean alwaysCheckForReleaseVersion
@Parameter(property="revapi.failBuildOnProblemsFound", defaultValue="true") protected boolean failBuildOnProblemsFound
failCriticality
).@Parameter(property="revapi.failOnUnresolvedArtifacts", defaultValue="false") protected boolean failOnUnresolvedArtifacts
@Parameter(property="revapi.failOnUnresolvedDependencies", defaultValue="false") protected boolean failOnUnresolvedDependencies
@Parameter(property="revapi.checkDependencies", defaultValue="true") protected boolean checkDependencies
However, setting this to false might be useful in situations where you have checked your dependencies in another module and don't want do that again. In that case, you might want to configure Revapi to ignore missing classes because it might find the classes from your dependencies as used in your API and would complain that it could not find it. See the docs.
@Parameter(property="revapi.resolveProvidedDependencies", defaultValue="true") protected boolean resolveProvidedDependencies
provided
dependencies.
The reason for this is that even though such dependencies do not appear in the transitive dependency set
established by maven, they need to be present both on the compilation and runtime classpath of the module.
Therefore, the classes in the module are free to expose classes from a provided dependency as API elements.
In rare circumstances this is not a desired behavior though. It is undesired if for example the classes from the provided dependency are used only for establishing desired build order or when they are used in some non-standard scenarios during the build and actually not needed at runtime.
Note that this property only influences the resolution of provided dependencies of the main artifacts, not
the transitively reachable provided dependencies. For those, use the resolveTransitiveProvidedDependencies
parameter.
@Parameter(property="revapi.resolveTransitiveProvidedDependencies", defaultValue="false") protected boolean resolveTransitiveProvidedDependencies
resolveProvidedDependencies
this property further controls how provided dependencies
are resolved. Using this property you can control how the indirect, transitively reachable, provided dependencies
are treated. The default is to not consider them, which is almost always the right thing to do. It might be
necessary to set this property to true
in the rare circumstances where the API of the main artifacts
includes types from such transitively included provided dependencies. Such occurrence will manifest itself by
Revapi considering such types as missing (which is by default reported as a potentially breaking change). When
you then resolve the transitive provided dependencies (by setting this parameter to true), Revapi will be able to
find such types and do a proper analysis of them.@Parameter(property="revapi.versionFormat", defaultValue="") protected String versionFormat
oldVersion
or newVersion
parameters are set to RELEASE
or LATEST
special version strings.
Because Maven will report the newest non-snapshot version as the latest release, we might end up comparing a
.Beta
or other pre-release versions with the new version. This might not be what you want and setting the
versionFormat will make sure that a newest version conforming to the version format is used instead of the one
resolved by Maven by default.
This parameter is a regular expression pattern that the version string needs to match in order to be considered
a RELEASE
.
@Parameter(property="revapi.expandProperties", defaultValue="false") protected boolean expandProperties
${var}
appearing in the configuration values will be replaced with the value of the
var
property as known to Maven. If the property is not defined, the expansion doesn't take place.public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
execute
in interface org.apache.maven.plugin.Mojo
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
public boolean isPreserveSuffix()
public String getReplacementSuffix()
public boolean isSingleVersionForAllModules()
protected org.revapi.Criticality determineMaximumCriticality(org.revapi.PipelineConfiguration pipelineConfiguration) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected org.revapi.AnalysisResult analyze(Class<? extends org.revapi.Reporter> reporter, org.revapi.PipelineConfiguration.Builder pipelineConfiguration, Object... contextDataKeyValues) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
protected Analyzer prepareAnalyzer(org.apache.maven.project.MavenProject project, org.revapi.PipelineConfiguration.Builder pipelineConfiguration, Class<? extends org.revapi.Reporter> reporter, Map<String,Object> contextData)
protected Analyzer prepareAnalyzer(org.apache.maven.project.MavenProject project, org.revapi.PipelineConfiguration.Builder pipelineConfiguration, Class<? extends org.revapi.Reporter> reporter, Map<String,Object> contextData, Map<String,Object> propertyOverrides)
protected boolean initializeComparisonArtifacts()
Copyright © 2014-2021 Lukas Krejci. All Rights Reserved.