@Mojo(name="report",
defaultPhase=SITE,
requiresDependencyCollection=COMPILE_PLUS_RUNTIME)
public class ReportMojo
extends org.apache.maven.reporting.AbstractMavenReport
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.
|
protected boolean |
expandProperties
If set to true, the Maven properties will be expanded in the configuration before it is supplied to Revapi.
|
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 boolean |
generateSiteReport
Set this to false if you want to use the goal to generate other kind of output than the default report for the
Maven-generated site.
|
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 String |
outputDirectory |
protected org.codehaus.plexus.configuration.PlexusConfiguration |
pipelineConfiguration
The JSON or XML configuration of the extensions pipeline.
|
protected String |
reportCriticality
The minimum criticality of the differences that should be included in the report.
|
protected FailSeverity |
reportSeverity
Deprecated.
use
reportCriticality instead |
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 |
---|
ReportMojo() |
Modifier and Type | Method and Description |
---|---|
boolean |
canGenerateReport() |
protected void |
endReport(org.apache.maven.doxia.sink.Sink sink) |
protected void |
executeReport(Locale locale) |
protected ResourceBundle |
getBundle(Locale locale) |
String |
getDescription(Locale locale) |
String |
getName(Locale locale) |
protected String |
getOutputDirectory() |
String |
getOutputName() |
protected org.apache.maven.project.MavenProject |
getProject() |
protected String |
niceList(Iterable<? extends org.revapi.Archive> archives) |
protected Analyzer |
prepareAnalyzer(Locale locale) |
protected void |
reportBody(ReportTimeReporter reporterWithResults,
org.revapi.API oldAPI,
org.revapi.API newAPI,
org.apache.maven.doxia.sink.Sink sink,
ResourceBundle messages) |
protected void |
startReport(org.apache.maven.doxia.sink.Sink sink,
ResourceBundle messages) |
closeReport, execute, generate, generate, generate, getCategoryName, getInputEncoding, getOutputEncoding, getReportOutputDirectory, getSink, getSinkFactory, getSiteRenderer, isExternalReport, setReportOutputDirectory
@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.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.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.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
@Deprecated @Parameter(property="revapi.reportSeverity", defaultValue="potentiallyBreaking") protected FailSeverity reportSeverity
reportCriticality
instead@Parameter(property="revapi.minimumCriticality") protected String reportCriticality
allowed
, documented
, highlight
, error
).
If not defined, the value is derived from reportSeverity
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(property="revapi.skip", defaultValue="false") protected boolean skip
@Parameter(property="revapi.outputDirectory", defaultValue="${project.reporting.outputDirectory}", required=true, readonly=true) protected String outputDirectory
@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
.
@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.failOnUnresolvedArtifacts", defaultValue="false") protected boolean failOnUnresolvedArtifacts
@Parameter(property="revapi.failOnUnresolvedDependencies", defaultValue="false") protected boolean failOnUnresolvedDependencies
@Parameter(property="revapi.generateSiteReport", defaultValue="true") protected boolean generateSiteReport
@Parameter(property="revapi.disallowedExtensions", defaultValue="") 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="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.protected String getOutputDirectory()
getOutputDirectory
in class org.apache.maven.reporting.AbstractMavenReport
protected org.apache.maven.project.MavenProject getProject()
getProject
in class org.apache.maven.reporting.AbstractMavenReport
public boolean canGenerateReport()
canGenerateReport
in interface org.apache.maven.reporting.MavenReport
canGenerateReport
in class org.apache.maven.reporting.AbstractMavenReport
protected void executeReport(Locale locale) throws org.apache.maven.reporting.MavenReportException
executeReport
in class org.apache.maven.reporting.AbstractMavenReport
org.apache.maven.reporting.MavenReportException
protected void startReport(org.apache.maven.doxia.sink.Sink sink, ResourceBundle messages)
protected void endReport(org.apache.maven.doxia.sink.Sink sink)
protected void reportBody(ReportTimeReporter reporterWithResults, org.revapi.API oldAPI, org.revapi.API newAPI, org.apache.maven.doxia.sink.Sink sink, ResourceBundle messages)
public String getOutputName()
protected ResourceBundle getBundle(Locale locale)
Copyright © 2014-2020 Lukas Krejci. All Rights Reserved.