davidB / scala-maven-plugin

The scala-maven-plugin (previously maven-scala-plugin) is used for compiling/testing/running/documenting scala code in maven.
https://davidb.github.io/scala-maven-plugin/
The Unlicense
554 stars 150 forks source link

Need to update to handle the movement of doxia to apache #726

Closed hunterpayne closed 10 months ago

hunterpayne commented 10 months ago

org.codehaus.doxia.sink.Sink (and all doxia classes) need to change to org.apache.doxia.sink.Sink This causes the plugin to not work with newer versions of maven which look for org.apache.doxia classes instead of org.codehaus.doxia.

slandelle commented 10 months ago
  1. Any reliable source/official documentation or just the deprecated annotation and the doxia javadoc?
  2. Deadline? What does "newer versions of maven" mean here? Maven 4?
  3. Migration path? In particular, how are plugins supposed to maintain compatibility with older maven version?

We currently depend on org.apache.maven.reporting:maven-reporting-api:3.1.1 which is the latest stable version (newer versions are milestones of version 4). My guess is that MavenReport will only be updated to directly depend on org.apache.doxia.sink.Sink instead of org.codehaus.doxia.sink.Sink (that extends to interface in the new package) as of maven 4.

Unless I'm missing something, that's only a move we'll do once maven 4 stable is out. And if it's a breaking change with no means to easily maintain compatibility with maven 3, this will have to go in a new major version of this plugin. Then, this would likely mean dropping support for maven 3 as this project is understaffed and I won't have the bandwidth to maintain multiple versions.

hunterpayne commented 10 months ago

I'm seeing this in Maven 3.8.5. With maven-site-plugin 3.12.0. Maven seems to be looking for a generate method whose first argument is of type org.apache.doxia.sink.Sink.

https://github.com/apache/maven-site-plugin/blob/8c597d8db03633feb010cacb2a036b1cceb29aee/src/main/java/org/apache/maven/plugins/site/render/ReportDocumentRenderer.java#L35

What's weird is that I can't seen to find in the git history when the switch was made. Perhaps I just have something weird with my site setup. Here is the exception I am seeing.

java.lang.AbstractMethodError: Receiver class scala_maven.ScalaDocMojo does not define or inherit an implementation of the resolved method 'abstract void generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)' of interface org.apache.maven.reporting.MavenReport. at org.apache.maven.plugins.site.render.ReportDocumentRenderer.renderDocument (ReportDocumentRenderer.java:235) at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:348) at org.apache.maven.plugins.site.render.SiteMojo.renderLocale (SiteMojo.java:194) at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:143) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)

hunterpayne commented 10 months ago

Maybe this is a bug in the maven-site-plugin?

hunterpayne commented 10 months ago

It also seems that the sink argument isn't even used in your code. Seems like it would be pretty easy to just duplicate the method for both impls. Its just in one place in the code. No need to maintain 2 versions.

slandelle commented 10 months ago

Both maven-reporting-api:3.1.0 and maven-reporting-api:3.1.1 contain the interface org.apache.maven.reporting.MavenReport whose generate method takes a org.codehaus.doxia.sink.Sink, NOT a org.apache.doxia.sink.Sink, see https://github.com/apache/maven-reporting-api/blob/maven-reporting-api-3.1.1/src/main/java/org/apache/maven/reporting/MavenReport.java#L22C8-L22C36

does not define or inherit an implementation of the resolved method 'abstract void generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)' of interface org.apache.maven.reporting.MavenReport.

This means that:

I think it's an issue on your side and not a bug in this plugin.

If you disagree, please provide a reproducer as described here.

hunterpayne commented 10 months ago

I am not developing a maven plugin so I don't understand how this is happening. But it does seem to be in the site-plugin and not your plugin so I'm going to close this ticket. Thank you for your help. I appreciate your work on this project.