Hello Maven community.
In a Maven plugin using old 1.x Doxia and Sitetool versions, I am getting
warnings because those again use an EOL Plexus component. The details are not
so important, the important part is that I tried to upgrade those dependencies
to the most recent Doxia and Sitetools versions.
One class in the plugin extends org.apache.maven.reporting.AbstractMavenReport.
It implements an executeReport(Locale) method, which so far was fine. But now,
it also inherits execute() from the abstract parent class. The latter method is
always called when using the reporting goal for my plugin. The result is an
error like this:
Caused by: java.lang.NullPointerException: Cannot invoke
"org.apache.maven.doxia.tools.SiteTool.getSiteLocales(String)" because
"this.siteTool" is null
at org.apache.maven.reporting.AbstractMavenReport.getLocale
(AbstractMavenReport.java:400)
at org.apache.maven.reporting.AbstractMavenReport.reportToMarkup
(AbstractMavenReport.java:212)
at org.apache.maven.reporting.AbstractMavenReport.execute
(AbstractMavenReport.java:189)
I see that AbstractMavenReport defines the 'siteTool' field as follows:
@Component
protected SiteTool siteTool;
I am wondering why that field is null. Should it not be populated automatically
by dependency injection? I have a dirty workaround for this problem:
@Override
public void execute() throws MojoExecutionException {
//super.execute();
try {
executeReport(Locale.getDefault());
}
catch (MavenReportException e) {
throw new MojoExecutionException(e);
}
}
This way, 'siteTool' is not used and method SiteTool.getSiteLocales(String)
never called. But I guess, that is not a good solution to the problem. How are
plugin implementors meant to deal with this situation? Or is this some kind of
bug? I am unsure how to proceed. I am by no means a Maven plugin buff and
merely helping to keep an existing plugin alive. I would be grateful for hints.
Regards
--
Alexander Kriegisch
https://scrum-master.de
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]