> I tried to upgrade those
> dependencies to the most recent Doxia and Sitetools versions.
by "most recent", do you mean most recent from 1.x or 2.0.0-M*?

1.x should not cause issues
2.0.0-M*, as expected from the version number, is more risky and not yet fully 
stable

Such reporting plugin coding has so many ways to be done that sharing a 
reproducer is the easiest way to have concrete view on what is happening, 
particularly if you're going to 2.0.0-M*

Regards,

Hervé

Le jeudi 7 septembre 2023, 04:35:29 CEST Alexander Kriegisch a écrit :
> 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





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to